| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail4421.d(16): Error: function `fail4421.U1.this(this)` destructors, postblits and invariants are not allowed in union `U1` |
| 5 |
fail_compilation/fail4421.d(17): Error: destructor `fail4421.U1.~this` destructors, postblits and invariants are not allowed in union `U1` |
| 6 |
fail_compilation/fail4421.d(18): Error: function `fail4421.U1.invariant` destructors, postblits and invariants are not allowed in union `U1` |
| 7 |
--- |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
*/ |
| 13 |
|
| 14 |
union U1 |
| 15 |
{ |
| 16 |
this(this); |
| 17 |
~this(); |
| 18 |
invariant() { } |
| 19 |
} |
| 20 |
|
| 21 |
struct S1 |
| 22 |
{ |
| 23 |
this(this); |
| 24 |
~this(); |
| 25 |
invariant() { } |
| 26 |
} |
| 27 |
|
| 28 |
union U2 |
| 29 |
{ |
| 30 |
S1 s1; |
| 31 |
} |
| 32 |
|
| 33 |
struct S2 |
| 34 |
{ |
| 35 |
union |
| 36 |
{ |
| 37 |
S1 s1; |
| 38 |
int j; |
| 39 |
} |
| 40 |
} |