================
@@ -1841,9 +1872,71 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation 
Loc, Decl *D) {
     // template parameter.
   }
 
+  if (auto *PVD = dyn_cast<ParmVarDecl>(D);
+      PVD && PVD->getDeclContext() == FunctionDCForParameterDeclInstantiation 
&&
+      !ParameterInstantiationScope->findInstantiationUnsafe(PVD)) {
+    // Fall through to the default lookup even if we have failed to instantiate
+    // anything. We're likely to crash thereafter.
+    instantiateParameterToScope(PVD, *ParameterInstantiationScope);
+  }
+
   return SemaRef.FindInstantiatedDecl(Loc, cast<NamedDecl>(D), TemplateArgs);
 }
 
+bool TemplateInstantiator::instantiateParameterToScope(
----------------
cor3ntin wrote:

Can we reuse the logic of `SetupConstraintScope` / 
`addInstantiatedParametersToScope` ? It seems very similar

https://github.com/llvm/llvm-project/pull/102857
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to