[clang] [clang][Sema] Improve template argument deduction diagnostic (PR #122754)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 03:38:23 PST 2025


================
@@ -3572,10 +3572,17 @@ TemplateDeductionResult Sema::SubstituteExplicitTemplateArguments(
                                 SugaredBuilder, CanonicalBuilder,
                                 /*UpdateArgsWithConversions=*/false) ||
       Trap.hasErrorOccurred()) {
+
     unsigned Index = SugaredBuilder.size();
     if (Index >= TemplateParams->size())
       return TemplateDeductionResult::SubstitutionFailure;
     Info.Param = makeTemplateParameter(TemplateParams->getParam(Index));
+    Info.FirstArg = ExplicitTemplateArgs[Index].getArgument();
+    if (ExplicitTemplateArgs[Index].getArgument().getKind() ==
+        TemplateArgument::Expression)
+      Info.SecondArg =
+          ExplicitTemplateArgs[Index].getSourceExpression()->getType();
----------------
mizvekov wrote:

Since you are adding new parameters for a `InvalidExplicitArguments`, did you audit all the users, in order to include the new information as well?

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


More information about the cfe-commits mailing list