| 1 |
/* REQUIRED_ARGS: -preview=fieldwise |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/test16284.d(24): Error: reinterpretation through overlapped field `s` is not allowed in CTFE |
| 5 |
fail_compilation/test16284.d(27): called from here: `test()` |
| 6 |
fail_compilation/test16284.d(27): while evaluating: `static assert(test())` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
// https://issues.dlang.org/show_bug.cgi?id=16284 |
| 11 |
|
| 12 |
struct S {} |
| 13 |
|
| 14 |
struct T |
| 15 |
{ |
| 16 |
union {int i; S s;} |
| 17 |
this(uint dummy) { s = S.init; } |
| 18 |
} |
| 19 |
|
| 20 |
bool test() |
| 21 |
{ |
| 22 |
auto t1 = T(0); |
| 23 |
auto t2 = T(0); |
| 24 |
return t1 == t2; |
| 25 |
} |
| 26 |
|
| 27 |
static assert(test()); |