| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/diag14102.d(14): Error: cannot modify expression `-x` because it is not an lvalue |
| 5 |
fail_compilation/diag14102.d(15): Error: cannot modify expression `-(x -= 1)` because it is not an lvalue |
| 6 |
fail_compilation/diag14102.d(16): Error: cannot modify expression `-(x -= 1 -= 1)` because it is not an lvalue |
| 7 |
fail_compilation/diag14102.d(17): Error: cannot modify expression `-(x -= 1 -= 1 -= 1)` because it is not an lvalue |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
int main() |
| 12 |
{ |
| 13 |
int x; |
| 14 |
return -- -x; // error: -x is not an lvalue |
| 15 |
return -- - --x; // error: -(x -= 1) is not an lvalue |
| 16 |
return -- - -- --x; // error: -((x -= 1 , x) -= 1) is not an lvalue |
| 17 |
return -- - -- -- --x; // error: -((ref int __assignop1 = x -= 1 , __assignop1 = x; , __assignop1 -= 1 , __assignop1) -= 1) is not an lvalue |
| 18 |
} |