Enable flate-combine.
[official-gcc.git] / gcc / testsuite / g++.dg / abi / no_unique_address8a.C
blobc5d480885292ca4da3a9d952c3c6fc40c543ca96
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-fabi-version=18 -Wabi=19" }
4 #include <cstddef>
6 #define NOUNIQUE [[no_unique_address]]
8 struct Empty { };
9 #define CHECK_DISTINCT(type, field1, field2) static_assert(offsetof(type, field1) != offsetof(type, field2))
10 #define CHECK_SAME(type, field1, field2) static_assert(offsetof(type, field1) == offsetof(type, field2))
12 struct A1 {
13     NOUNIQUE Empty a;
14     Empty b;
16 CHECK_DISTINCT(A1, a, b);
17 struct A2 {
18     NOUNIQUE const Empty a;
19     const Empty b;
21 CHECK_DISTINCT(A2, a, b);
22 struct A3 {                     // { dg-warning "layout" }
23     NOUNIQUE const Empty a;
24     Empty b;
26 CHECK_SAME(A3, a, b);
27 struct A4 {                     // { dg-warning "layout" }
28     NOUNIQUE Empty a;
29     const Empty b;
31 CHECK_SAME(A4, a, b);