gcc/testsuite/g++.dg/abi/empty5.C
raw| 1 | // { dg-options "-fabi-version=0" } |
| 2 | |
| 3 | struct A {}; |
| 4 | |
| 5 | struct B { |
| 6 | A a; |
| 7 | virtual void f () {} |
| 8 | }; |
| 9 | |
| 10 | struct C : public B, public A {}; |
| 11 | |
| 12 | #if __cpp_attributes |
| 13 | struct C2 : public B |
| 14 | { |
| 15 | [[no_unique_address]] A a; |
| 16 | } c2; |
| 17 | #endif |
| 18 | |
| 19 | C c; |
| 20 | |
| 21 | int main () { |
| 22 | if ((void*) (A*) &c != &c) |
| 23 | return 1; |
| 24 | #if __cpp_attributes |
| 25 | if ((void*)&c2.a != &c2) |
| 26 | return 2; |
| 27 | #endif |
| 28 | } |