diff --git a/PExpr.cc b/PExpr.cc index f36c9aa0e..2b4c222ce 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -386,6 +386,18 @@ PEIdent::~PEIdent() { } +static bool find_enum_constant(LexicalScope*scope, perm_string name) +{ + for (set::const_iterator cur = scope->enum_sets.begin() ; + cur != scope->enum_sets.end() ; ++ cur) { + for (list::const_iterator idx = (*cur)->names->begin() ; + idx != (*cur)->names->end() ; ++ idx) { + if (idx->name == name) return true; + } + } + return false; +} + void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type) { /* We create an implicit wire if: @@ -409,6 +421,8 @@ void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type) return; if (ss->events.find(name) != ss->events.end()) return; + if (find_enum_constant(ss, name)) + return; /* Strictly speaking, we should also check for name clashes with tasks, functions, named blocks, module instances, and generate blocks. However, this information is not