[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 27 02:40:47 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list