[clang] [Clang][RFC] Do not eat SFINAE diagnostics for explicit template arguments (PR #139066)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon May 12 02:32:19 PDT 2025


================
@@ -12166,6 +12174,15 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
              diag::note_ovl_candidate_explicit_arg_mismatch_unnamed)
           << (index + 1);
     }
+
+    if (PartialDiagnosticAt *PDiag = DeductionFailure.getSFINAEDiagnostic()) {
+      unsigned DiagID =
----------------
zyn0217 wrote:

> An alternative here, instead of degrading the level of diagnostic, would be to come up with a way to establish a nesting of diagnostics, beyond what we do implicitly, with notes always attached to the previous non-note diagnostic.

Can you please say more? Our current deduction failure diagnostics are already implemented in the way that note diagnostics (like SFINAE errors) are attached to the error, right?

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


More information about the cfe-commits mailing list