| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/test21247.d(13): Error: anonymous union can only be a part of an aggregate, not function `hang_dmd` |
| 5 |
fail_compilation/test21247.d(17): Error: undefined identifier `u` |
| 6 |
fail_compilation/test21247.d(18): Error: undefined identifier `b` |
| 7 |
fail_compilation/test21247.d(20): called from here: `hang_dmd(0u)` |
| 8 |
--- |
| 9 |
*/ |
| 10 |
// https://github.com/dlang/dmd/issues/21247 |
| 11 |
ubyte[4] hang_dmd(uint a) |
| 12 |
{ |
| 13 |
union { |
| 14 |
uint u = void; |
| 15 |
ubyte[4] b; |
| 16 |
} |
| 17 |
u = a; |
| 18 |
return b; |
| 19 |
} |
| 20 |
enum T = hang_dmd(0); |