gcc/testsuite/gdc.test/fail_compilation/bug18743.d
raw| 1 | // REQUIRED_ARGS: |
| 2 | /* |
| 3 | TEST_OUTPUT: |
| 4 | --- |
| 5 | fail_compilation/bug18743.d(18): Error: `a ? a = 4 : a` must be surrounded by parentheses when next to operator `=` |
| 6 | fail_compilation/bug18743.d(19): Error: `a ? --a : a` must be surrounded by parentheses when next to operator `+=` |
| 7 | --- |
| 8 | */ |
| 9 | |
| 10 | void main() |
| 11 | { |
| 12 | int a; |
| 13 | |
| 14 | // ok |
| 15 | (a ? a = 4 : a) = 5; |
| 16 | a ? a = 4 : (a = 5); |
| 17 | |
| 18 | a ? a = 4 : a = 5; |
| 19 | a ? --a : a += 1; |
| 20 | |
| 21 | a ? a = 4 : a++; // ok |
| 22 | } |