[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
================
@@ -4870,14 +4870,17 @@ def note_ovl_candidate_inconsistent_deduction_types : Note<
"candidate template ignored: deduced values %diff{"
"of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
"%1 and %3 of conflicting types for parameter %0}2,4">;
-def note_ovl_candidate_explicit_arg_mismatch_named : Note<
- "candidate template ignored: invalid explicitly-specified argument "
- "for template parameter %0">;
+
+def note_ovl_candidate_explicit_arg_mismatch : Note<
+ "candidate template ignored: invalid explicitly-specified argument"
+ "%select{"
+ "|: %select{non-type|type}1 argument %select{'%3'|%3}1 is not compatible with "
+ "%select{non-type|type}2 parameter %select{%5|%4}2"
+ "|: could not convert '%3' from %4 to %5"
+ "| for %ordinal6 template parameter}0">;
----------------
mizvekov wrote:
You don't need to talk about the parameter since we emit a separate note for it, that should make this diagnostic a bit simpler, as right now it's stretching it on complexity.
If we are talking about argument / parameter kinds, it would make sense to talk about 'template' kind, besides non-type and type, otherwise some mismatches could happen between non-type kinds and that's a bit confusing.
https://github.com/llvm/llvm-project/pull/122754
More information about the cfe-commits
mailing list