blob: 22526d6b59a4e9a9379108e14f678212ae33b2bf (
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
38
39
|
// PR c++/32992
// { dg-do run }
// { dg-options "-O2" }
extern "C" void abort (void);
struct A
{
long int a1;
long int a2;
long int a3;
};
struct B
{
long int f[3];
operator A ()
{
union
{
long int t[3];
A a;
};
for (int i = 0; i < 3; i++)
t[i] = f[i];
return a;
}
};
int
main ()
{
B b = { {1, 3, 5} };
A a = b;
if (a.a1 != b.f[0] || a.a2 != b.f[1] || a.a3 != b.f[2])
abort ();
return 0;
}
|