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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 3 09:29:21 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);
----------------
zyn0217 wrote:

> I notice we have a `FunctionParam->setDeclName(PatternParam->getDeclName());` not far below this point. Do we also need to apply a fix there?

No? Unless we allowed default arguments on parameter packs


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


More information about the cfe-commits mailing list