[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 27 04:45:52 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();
----------------
sdkrystian wrote:

I was planning to do that in a separate PR... but I could just throw in here I suppose 

https://github.com/llvm/llvm-project/pull/79683


More information about the cfe-commits mailing list