[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 2 09:08:40 PDT 2025


================
@@ -2083,6 +2086,88 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef,
   SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D;
 }
 
+static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef,
+                                               SourceLocation Loc,
+                                               const CXXRecordDecl *D) {
+  for (const CXXBaseSpecifier &B : D->bases()) {
+    assert(B.getType()->getAsCXXRecordDecl() && "invalid base?");
+    if (B.isVirtual())
+      SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
+          << diag::TraitNotSatisfiedReason::VBase << B.getType()
+          << B.getSourceRange();
+    if (!B.getType().isTriviallyCopyableType(D->getASTContext())) {
----------------
shafik wrote:

Is this if statement covered in the tests below?

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


More information about the cfe-commits mailing list