gcc/testsuite/g++.dg/abi/no_unique_address4.C
raw| 1 | // Test that [[no_unique_address]] makes the enclosing class non-layout-POD. |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A {}; |
| 5 | struct B1: A { |
| 6 | int i; |
| 7 | char c; |
| 8 | }; |
| 9 | |
| 10 | struct B2 { |
| 11 | [[no_unique_address]] A a; |
| 12 | int i; |
| 13 | char c; |
| 14 | }; |
| 15 | |
| 16 | struct C1: B1 { |
| 17 | char d; |
| 18 | }; |
| 19 | |
| 20 | struct C2: B2 { |
| 21 | char d; |
| 22 | }; |
| 23 | |
| 24 | #define SA(X) static_assert((X),#X) |
| 25 | SA(sizeof(C1) == sizeof(C2)); |