[clang] [clang][Sema] Improve template argument deduction diagnostic (PR #122754)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 9 06:16:00 PDT 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:
If you can't, or otherwise this new signature doesn't make sense for the pre-existing callers, you should create a new result kind instead.
https://github.com/llvm/llvm-project/pull/122754
More information about the cfe-commits
mailing list