[clang] [Clang] Added explanation why a is constructible evaluated to false. (PR #143309)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 8 07:53:49 PDT 2025


================
@@ -2159,6 +2167,26 @@ static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef,
   }
 }
 
+static void DiagnoseNonConstructibleReason(Sema &SemaRef, SourceLocation Loc,
+                                           QualType T) {
+  SemaRef.Diag(Loc, diag::note_unsatisfied_trait)
----------------
cor3ntin wrote:

I think what would be useful here is to try to run overload resolution again on all the arguments,
and show the errors - https://compiler-explorer.com/z/aMG1nEoz1

You can look at how `static bool EvaluateBooleanTypeTrait` works (in the same file).

I think that by calling `InitializationSequence::Diagnose` we would get super useful diagnostics. 

We don't have a good way to turn the errors that would be produced into notes, though @AaronBallman @erichkeane @Sirraide  - but maybe emitting errors is good enough as a first approach

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


More information about the cfe-commits mailing list