Improve error message for an enum name conflicting with non-enum ID

This commit is contained in:
Jon Siwek 2020-07-31 16:24:26 -07:00
parent 4a9567e04f
commit 69c0cf1513
3 changed files with 10 additions and 0 deletions

View file

@ -1269,6 +1269,7 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name,
// cyclic dependencies.
string fullname = make_full_var_name(module_name.c_str(), name);
if ( id->Name() != fullname
|| ! id->IsEnumConst()
|| (id->HasVal() && val != id->GetVal()->AsEnum())
|| GetName() != id->GetType()->GetName()
|| (names.find(fullname) != names.end() && names[fullname] != val) )