blob: e1cfeb25377e3bfaaa2d84a34748b9b830da77af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// { dg-do run }
extern "C" void abort ();
struct A {
union {
int a;
double b;
int d;
};
int c;
};
struct B : public A {
union {
double a;
void *c;
};
float b;
int e;
};
int main ()
{
struct B b;
b.a = 1.5;
b.b = 2.5;
b.d = 1;
b.e = 2;
if (b.a != 1.5 || b.b != 2.5 || b.d != 1 || b.e != 2)
abort ();
b.c = &b.a;
b.d = b.e;
if (b.c != &b.a || b.d != 2)
abort ();
return 0;
}
|