gcc/testsuite/gdc.test/fail_compilation/fail4375q.d
raw| 1 | // REQUIRED_ARGS: -w |
| 2 | // https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else |
| 3 | /* |
| 4 | TEST_OUTPUT: |
| 5 | --- |
| 6 | fail_compilation/fail4375q.d(17): Warning: else is dangling, add { } after condition at fail_compilation/fail4375q.d(13) |
| 7 | fail_compilation/fail4375q.d(14): Error: `with` expression types must be enums or aggregates or pointers to them, not `int` |
| 8 | --- |
| 9 | */ |
| 10 | |
| 11 | void main() { |
| 12 | auto x = 1; |
| 13 | if (true) |
| 14 | with (x) |
| 15 | if (false) |
| 16 | assert(90); |
| 17 | else |
| 18 | assert(91); |
| 19 | } |