================
@@ -2840,8 +2841,22 @@ buildAssociatedConstraints(Sema &SemaRef, 
FunctionTemplateDecl *F,
 
   for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
     const auto &D = DeduceResults[Index];
-    if (D.isNull())
+    if (D.isNull()) { // non-deduced template parameters of f
+      auto TP = F->getTemplateParameters()->getParam(Index);
+      MultiLevelTemplateArgumentList Args;
+      Args.setKind(TemplateSubstitutionKind::Rewrite);
+      Args.addOuterTemplateArguments(TemplateArgsForBuildingRC);
+      // Rebuild the template parameter with updated depth and index.
+      NamedDecl *NewParam = transformTemplateParameter(
+          SemaRef, F->getDeclContext(), TP, Args,
+          /*NewIndex=*/UndeducedTemplateParameterStartIndex++,
+          getTemplateParameterDepth(TP) + AdjustDepth);
----------------
mizvekov wrote:

Took me a while to spot that one:
```suggestion
      NamedDecl *NewParam = transformTemplateParameter(
          SemaRef, F->getDeclContext(), TP, Args,
          /*NewIndex=*/UndeducedTemplateParameterStartIndex,
          getTemplateParameterDepth(TP) + AdjustDepth);
          UndeducedTemplateParameterStartIndex += 1;
```

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

Reply via email to