gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ctfe10995.d(19): Error: cannot read uninitialized variable `a` in CTFE |
| 5 | fail_compilation/ctfe10995.d(25): Error: cannot read uninitialized variable `a` in CTFE |
| 6 | --- |
| 7 | */ |
| 8 | struct T |
| 9 | { |
| 10 | short a = void; |
| 11 | } |
| 12 | |
| 13 | T foo() |
| 14 | { |
| 15 | auto t = T.init; |
| 16 | return t; |
| 17 | } |
| 18 | |
| 19 | enum i = foo().a; |
| 20 | |
| 21 | struct T2 |
| 22 | { |
| 23 | short a = void; |
| 24 | } |
| 25 | enum i2 = T2.init.a; |