| 1 |
// https://bugzilla.gdcproject.org/show_bug.cgi?id=210 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } |
| 4 |
|
| 5 |
struct S210 |
| 6 |
{ |
| 7 |
ubyte a; |
| 8 |
uint b; |
| 9 |
} |
| 10 |
|
| 11 |
union U210 |
| 12 |
{ |
| 13 |
S210 a; |
| 14 |
uint b; |
| 15 |
} |
| 16 |
|
| 17 |
S210 test210a() |
| 18 |
{ |
| 19 |
S210 s = S210(1, 2); |
| 20 |
return s; |
| 21 |
} |
| 22 |
|
| 23 |
S210[2] test210b() |
| 24 |
{ |
| 25 |
S210[2] s = [S210(1, 2), S210(3, 4)]; |
| 26 |
return s; |
| 27 |
} |
| 28 |
|
| 29 |
U210 test210c() |
| 30 |
{ |
| 31 |
U210 s = U210(S210(1, 2)); |
| 32 |
return s; |
| 33 |
} |
| 34 |
|
| 35 |
U210[2] test210d() |
| 36 |
{ |
| 37 |
U210[2] s = [U210(S210(1, 2)), U210(S210(3, 4))]; |
| 38 |
return s; |
| 39 |
} |
| 40 |
|
| 41 |
void main() |
| 42 |
{ |
| 43 |
S210 a = S210(1, 2); |
| 44 |
assert(a == S210(1, 2)); |
| 45 |
assert(a == test210a()); |
| 46 |
assert(a != S210(2, 1)); |
| 47 |
|
| 48 |
S210[2] b = [S210(1, 2), S210(3, 4)]; |
| 49 |
assert(b == [S210(1, 2), S210(3, 4)]); |
| 50 |
assert(b == test210b()); |
| 51 |
assert(b != [S210(2, 1), S210(3, 4)]); |
| 52 |
|
| 53 |
U210 c = U210(S210(1, 2)); |
| 54 |
assert(c == U210(S210(1, 2))); |
| 55 |
assert(c == test210c()); |
| 56 |
assert(c != U210(S210(2, 1))); |
| 57 |
|
| 58 |
U210[2] d = [U210(S210(1, 2)), U210(S210(3, 4))]; |
| 59 |
assert(d == [U210(S210(1, 2)), U210(S210(3, 4))]); |
| 60 |
assert(d == test210d()); |
| 61 |
assert(d != [U210(S210(2, 1)), U210(S210(3, 4))]); |
| 62 |
} |