repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Enable flate-combine.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
abi
/
no_unique_address1.C
blob
853726dd4b0cf609d3a8f0ea612a731dc50317f5
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
}