================ @@ -1523,7 +1523,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { // Out-of-line definitions shouldn't be pushed into scope in C++, unless they // are function-local declarations. - if (getLangOpts().CPlusPlus && D->isOutOfLine() && !S->getFnParent()) + bool OutOfLine = D->isOutOfLine(); + if (const auto *ECD = dyn_cast<EnumConstantDecl>(D)) + OutOfLine = OutOfLine || cast<Decl>(ECD->getDeclContext())->isOutOfLine(); ---------------- erichkeane wrote:
Hmm... What is the logic to set the `EnumConstantDecl` (or, that is, just the `Decls` themselves) to be `OutOfLine`? I can't imagine this is the only logic for `OutOfLine` that could be reasonable to check, and wonder if we should just set `EnumConstantDecl::OutOfLine` 'correctly'. WDYT? https://github.com/llvm/llvm-project/pull/134998 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits