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

Shamshura Egor via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 12 06:25:44 PDT 2025


================
@@ -2253,6 +2260,60 @@ static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef,
   }
 }
 
+static void DiagnoseNonConstructibleReason(
+    Sema &SemaRef, SourceLocation Loc,
+    const llvm::SmallVector<clang::QualType, 1> &Ts) {
+  bool CompleteTypes = true;
+  for (const auto &ArgTy : Ts) {
+    if (ArgTy->isVoidType() || ArgTy->isIncompleteArrayType())
+      continue;
+    if (ArgTy->isIncompleteType()) {
+      SemaRef.Diag(Loc, diag::err_incomplete_type_used_in_type_trait_expr)
+          << ArgTy;
+      CompleteTypes = false;
+    }
+  }
+  if (!CompleteTypes)
+    return;
----------------
egorshamshura wrote:

And now, for every cv void type, we show a note, but is this a good practice? Or do we want to show it once?

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


More information about the cfe-commits mailing list