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