[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:10:54 PDT 2025
================
@@ -144,3 +144,54 @@ static_assert(__builtin_is_cpp_trivially_relocatable(U2));
// expected-note@#tr-U2 {{'U2' defined here}}
}
+
+namespace trivially_copyable {
+struct B {
+ virtual ~B();
+};
+struct S : virtual B { // #tc-S
+ S();
+ int & a;
+ const int ci;
+ B & b;
+ B c;
+ ~S();
+};
+static_assert(__is_trivially_copyable(S));
+// expected-error at -1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S)'}} \
+// expected-note at -1 {{'S' is not trivially copyable}} \
+// expected-note at -1 {{because it has a virtual base 'B'}} \
+// expected-note at -1 {{because it has a non-trivially-copyable base 'B'}} \
----------------
egorshamshura wrote:
Added some tests for this case
https://github.com/llvm/llvm-project/pull/142341
More information about the cfe-commits
mailing list