1 | struct Empty {}; |
---|---|
2 | |
3 | namespace basic { |
4 | struct Foo { |
5 | [[no_unique_address]] Empty a; |
6 | }; |
7 | } // namespace basic |
8 | |
9 | namespace bases { |
10 | struct A { |
11 | long c, d; |
12 | }; |
13 | |
14 | struct B { |
15 | [[no_unique_address]] Empty x; |
16 | }; |
17 | |
18 | struct C { |
19 | [[no_unique_address]] Empty x; |
20 | }; |
21 | |
22 | struct Foo : B, A, C {}; |
23 | struct Bar : B, C, A {}; |
24 | } // namespace bases |
25 | |
26 | int main() { |
27 | basic::Foo b1; |
28 | bases::Foo b2; |
29 | bases::Bar b3; |
30 | b2.c = 1; |
31 | b2.d = 2; |
32 | b3.c = 5; |
33 | b3.d = 6; |
34 | return 0; |
35 | } |
36 |