diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -4256,7 +4256,7 @@ bool DeclarationVisitor::Pre(const parser::Enumerator &enumerator) { const parser::Name &name{std::get(enumerator.t).v}; - Symbol *symbol{FindSymbol(name)}; + Symbol *symbol{FindInScope(name)}; if (symbol && !symbol->has()) { // Contrary to named constants appearing in a PARAMETER statement, // enumerator names should not have their type, dimension or any other