[clang] [Clang] Fix crash on template-specialization (PR #142338)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 2 06:57:39 PDT 2025


================
@@ -5120,6 +5121,10 @@ bool Sema::addInstantiatedParametersToScope(
       // Simple case: not a parameter pack.
       assert(FParamIdx < Function->getNumParams());
       ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
+      DeclarationName name = FunctionParam->getDeclName();
+      auto _ = llvm::make_scope_exit([&]() {
+        FunctionParam->setDeclName(name);
----------------
erichkeane wrote:

Something about this being done at scope-exist makes me think this is a smell.  I don't think I understand what is going on here enough with the various names enough to know whether this is OK.  Could @zygoloid take a quick look and see if this is crazy or not?

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


More information about the cfe-commits mailing list