Debian Codegraph @

gcc/testsuite/g++.dg/abi/base-defaulted1a.C

raw
1 // PR c++/120012
2 // { dg-do compile { target c++11 } }
3 // { dg-additional-options "-fabi-version=20 -Wabi" }
4
5 struct A
6 {
7 A(const A&) = default;
8 A(A&&) = default;
9 A& operator=(A&&) = default;
10 unsigned int a;
11 unsigned char b;
12 };
13 struct B: A
14 {
15 unsigned char c; // { dg-warning "offset" "" { target c++20 } }
16 };
17
18 static_assert(sizeof(A) == (2 * sizeof(unsigned int)), "");
19 #if __cplusplus >= 202002L
20 static_assert(sizeof(B) == (2 * sizeof(unsigned int)), "");
21 #else
22 static_assert(sizeof(B) == (3 * sizeof(unsigned int)), "");
23 #endif