| 1 |
// PR c++/102295 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
struct A { int a; int b[]; }; |
| 6 |
struct B { B (); int k; }; |
| 7 |
struct C { int l; B m[]; }; |
| 8 |
|
| 9 |
int x[4]; |
| 10 |
A c = { 42, { ++x[0], ++x[1], ++x[2], ++x[3] } }; |
| 11 |
A d = { 43, { 0, ++x[0], ++x[1], ++x[2], ++x[3] } }; |
| 12 |
A e = { 44, { ++x[0], ++x[1], ++x[2], 17 } }; |
| 13 |
A f = { 45 }; |
| 14 |
C n = { 50, { B (), B () } }; |
| 15 |
C o = { 51, {} }; |
| 16 |
|
| 17 |
int |
| 18 |
main () |
| 19 |
{ |
| 20 |
static A g = { 46, { ++x[0], ++x[1], ++x[2], ++x[3] } }; |
| 21 |
static A h = { 47, { 0, ++x[0], ++x[1], ++x[2], ++x[3] } }; |
| 22 |
static A i = { 48, { ++x[0], ++x[1], ++x[2], 18 } }; |
| 23 |
static A j = { 49 }; |
| 24 |
if (c.a != 42 || c.b[0] != 1 || c.b[1] != 1 || c.b[2] != 1 || c.b[3] != 1) |
| 25 |
__builtin_abort (); |
| 26 |
if (d.a != 43 || d.b[0] != 0 || d.b[1] != 2 || d.b[2] != 2 || d.b[3] != 2 || d.b[4] != 2) |
| 27 |
__builtin_abort (); |
| 28 |
if (e.a != 44 || e.b[0] != 3 || e.b[1] != 3 || e.b[2] != 3 || e.b[3] != 17) |
| 29 |
__builtin_abort (); |
| 30 |
if (f.a != 45) |
| 31 |
__builtin_abort (); |
| 32 |
if (g.a != 46 || g.b[0] != 4 || g.b[1] != 4 || g.b[2] != 4 || g.b[3] != 3) |
| 33 |
__builtin_abort (); |
| 34 |
if (h.a != 47 || h.b[0] != 0 || h.b[1] != 5 || h.b[2] != 5 || h.b[3] != 5 || h.b[4] != 4) |
| 35 |
__builtin_abort (); |
| 36 |
if (i.a != 48 || i.b[0] != 6 || i.b[1] != 6 || i.b[2] != 6 || i.b[3] != 18) |
| 37 |
__builtin_abort (); |
| 38 |
if (j.a != 49) |
| 39 |
__builtin_abort (); |
| 40 |
if (n.l != 50 || n.m[0].k != 42 || n.m[1].k != 42) |
| 41 |
__builtin_abort (); |
| 42 |
if (o.l != 51) |
| 43 |
__builtin_abort (); |
| 44 |
if (x[0] != 6 || x[1] != 6 || x[2] != 6 || x[3] != 4) |
| 45 |
__builtin_abort (); |
| 46 |
} |
| 47 |
|
| 48 |
B::B () : k (42) |
| 49 |
{ |
| 50 |
} |