comparison gcc/testsuite/g++.dg/abi/no_unique_address1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // { dg-do run { target c++2a } }
2
3 struct B { };
4
5 struct A
6 {
7 [[no_unique_address]] B b;
8 int i;
9 };
10
11 struct C
12 {
13 B b;
14 int i;
15 };
16
17 struct D: B { };
18
19 struct E
20 {
21 B b [[no_unique_address]];
22 D d [[no_unique_address]];
23 };
24
25 constexpr bool same (void *x, void *y) { return x == y; }
26
27 int main()
28 {
29 A a;
30 if (!same(&a.b, &a.i))
31 __builtin_abort();
32 C c;
33 if (same(&c.b, &c.i))
34 __builtin_abort();
35 E e;
36 if (same (&e.b, &e.d))
37 __builtin_abort();
38 }