gcc/testsuite/g++.dg/abi/no_unique_address6.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #pragma GCC diagnostic ignored "-Winvalid-offsetof" |
| 4 | |
| 5 | struct E { }; |
| 6 | |
| 7 | struct A: virtual E { |
| 8 | // Deny the vbase offset 0 so it goes at the end. |
| 9 | [[no_unique_address]] E e1; |
| 10 | char c; |
| 11 | }; |
| 12 | |
| 13 | struct B : public A { |
| 14 | char d; |
| 15 | }; |
| 16 | |
| 17 | struct C { |
| 18 | [[no_unique_address]] A a; |
| 19 | char d; |
| 20 | }; |
| 21 | |
| 22 | #define SA(X) static_assert ((X),#X) |
| 23 | SA(__builtin_offsetof (B, d) == __builtin_offsetof (C, d)); |