================
@@ -4698,7 +4698,22 @@ void Sema::InstantiateExceptionSpec(SourceLocation 
PointOfInstantiation,
   // Enter the scope of this instantiation. We don't use
   // PushDeclContext because we don't have a scope.
   Sema::ContextRAII savedContext(*this, Decl);
+
+  FunctionDecl *Source = Proto->getExtProtoInfo().ExceptionSpec.SourceTemplate;
+  FunctionTemplateDecl *SourceTemplate = 
Source->getDescribedFunctionTemplate();
+  llvm::SmallDenseMap<clang::Decl *, clang::Decl *> InstTemplateParams;
+  if (CurrentInstantiationScope && SourceTemplate)
+    if (TemplateParameterList *TPL = SourceTemplate->getTemplateParameters())
+      for (NamedDecl *TemplateParam : *TPL)
+        if (auto *Found =
+                CurrentInstantiationScope->findInstantiationOf(TemplateParam))
+          if (auto *InstTemplateParam = Found->dyn_cast<clang::Decl *>())
+            InstTemplateParams[TemplateParam] = InstTemplateParam;
+
----------------
cor3ntin wrote:

I don't think this is handling the pack case..
Do we have a generic way to copy instantiated template params? @zyn0217 
@mizvekov @Sirraide
We do similar things in a bunch of places (including when checking constraints)

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

Reply via email to