================ @@ -6535,6 +6543,12 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D, if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); + // The scope passed in may not be a decl scope. Zip up the scope tree until + // we find one that is. + while ((S->getFlags() & Scope::DeclScope) == 0 || + (S->getFlags() & Scope::TemplateParamScope) != 0) + S = S->getParent(); ---------------- cor3ntin wrote:
We do that in at least 3 places (search for `(S->getFlags() & Scope::DeclScope)` ) Can we add a `Scope::getInnermostEnclosingDeclarativeScope()` or something like that ? https://github.com/llvm/llvm-project/pull/79683 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits