[clang] [clang][Sema] Improve template argument deduction diagnostic (PR #122754)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 29 07:56:07 PST 2025
================
@@ -11714,13 +11714,37 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
return;
}
- case TemplateDeductionResult::InvalidExplicitArguments:
+ case TemplateDeductionResult::InvalidExplicitArguments: {
assert(ParamD && "no parameter found for invalid explicit arguments");
- if (ParamD->getDeclName())
- S.Diag(Templated->getLocation(),
- diag::note_ovl_candidate_explicit_arg_mismatch_named)
- << ParamD->getDeclName();
- else {
+ if (ParamD->getDeclName()) {
----------------
mizvekov wrote:
Something like:
```C++
S.Diag(Templated->getLocation(),
diag::note_ovl_candidate_explicit_arg_mismatch_named)
<< 2 << FirstArg << SecondArg
<< NTTPD->getType() << NTTPD->getSourceRange();
```
Ie remove the name, add the SourceRange.
In clang diagnostics, we tend to avoid printing out things if we can just point to the source location instead.
https://github.com/llvm/llvm-project/pull/122754
More information about the cfe-commits
mailing list