gcc/testsuite/gdc.test/fail_compilation/fail4375p.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/fail4375p.d(19): Warning: else is dangling, add { } after condition at fail_compilation/fail4375p.d(12) |
| 7 | fail_compilation/fail4375p.d(16): Error: undefined identifier `x` |
| 8 | --- |
| 9 | */ |
| 10 | |
| 11 | void main() { |
| 12 | if (true) |
| 13 | while (false) |
| 14 | for (;;) |
| 15 | scope (exit) |
| 16 | synchronized (x) |
| 17 | if (true) |
| 18 | assert(90); |
| 19 | else |
| 20 | assert(89); |
| 21 | } |