[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)
Shamshura Egor via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 2 10:09:41 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())) {
----------------
egorshamshura wrote:
Added test for it
https://github.com/llvm/llvm-project/pull/142341
More information about the cfe-commits
mailing list