gcc/testsuite/gdc.test/fail_compilation/diag11132.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/diag11132.d(23): Error: overlapping initialization for field `a` and `b` |
| 5 | fail_compilation/diag11132.d(23): `struct` initializers that contain anonymous unions must initialize only the first member of a `union`. All subsequent non-overlapping fields are default initialized |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | struct S |
| 10 | { |
| 11 | int x; |
| 12 | union |
| 13 | { |
| 14 | int a; |
| 15 | int b; |
| 16 | } |
| 17 | |
| 18 | int z; |
| 19 | } |
| 20 | |
| 21 | void main() |
| 22 | { |
| 23 | S s = { 1, 2, 3 }; |
| 24 | } |