gcc/testsuite/gdc.test/runnable/test19822.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=19822 |
| 2 | struct Quat |
| 3 | { |
| 4 | static struct Vec { int x; } |
| 5 | |
| 6 | union |
| 7 | { |
| 8 | Vec v; |
| 9 | struct { float x; } |
| 10 | } |
| 11 | |
| 12 | static Quat identity() |
| 13 | { |
| 14 | Quat q; |
| 15 | q.x = 1.0f; |
| 16 | return q; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | struct QuatContainerWithIncompatibleInit |
| 21 | { |
| 22 | Quat q = Quat.identity; |
| 23 | } |
| 24 | |
| 25 | void main() |
| 26 | { |
| 27 | QuatContainerWithIncompatibleInit c; |
| 28 | assert(c.q.x == 1.0f); // fails |
| 29 | } |