Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/no_unique_address13.C

raw
1 // PR c++/101040
2 // { dg-do compile { target c++11 } }
3
4 // This class has to be empty.
5 struct empty
6 {};
7
8 // This class has to be empty.
9 struct single
10 {
11 // This member has to be no_unique_address.
12 [[no_unique_address]] empty obj;
13 };
14
15 // This class has to be empty and derived from single.
16 struct derived : single
17 {
18 // This constructor has to be constexpr and take a forwarding reference.
19 template <typename Arg>
20 constexpr derived(Arg&& arg) : single{arg}
21 {}
22 };
23
24 auto obj = derived{empty{}};