================
@@ -1078,15 +1078,19 @@ static bool 
CheckFunctionConstraintsWithoutInstantiation(
   // template. We need the entire list, since the constraint is completely
   // uninstantiated at this point.
 
-  // FIXME: Add TemplateArgs through the 'Innermost' parameter once
-  // the refactoring of getTemplateInstantiationArgs() relands.
-  MultiLevelTemplateArgumentList MLTAL;
-  MLTAL.addOuterTemplateArguments(Template, {}, /*Final=*/false);
-  SemaRef.getTemplateInstantiationArgs(
-      MLTAL, /*D=*/FD, FD,
+  // getTemplateInstantiationArgs uses this instantiation context to find out
+  // template arguments for uninstantiated functions.
+  std::optional<Sema::InstantiatingTemplate> Inst(
+      std::in_place, SemaRef, PointOfInstantiation,
+      Sema::InstantiatingTemplate::ConstraintsCheck{}, Template, TemplateArgs,
+      PointOfInstantiation);
+  if (Inst->isInvalid())
+    return true;
+  MultiLevelTemplateArgumentList MLTAL = SemaRef.getTemplateInstantiationArgs(
+      /*D=*/FD, FD,
       /*Final=*/false, /*Innermost=*/{}, /*RelativeToPrimary=*/true,
       /*Pattern=*/nullptr, /*ForConstraintInstantiation=*/true);
-  MLTAL.replaceInnermostTemplateArguments(Template, TemplateArgs);
+  Inst = std::nullopt;
----------------
cor3ntin wrote:

Do we gain anything by destroying the context here (and using an optional)?

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

Reply via email to