d: Merge upstream dmd ff57fec515, druntime ff57fec515, phobos 17bafda79.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag14102.d
blobb88dd7803cfed7441efe726d95f8e6cbe07a4a6a
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 */
11 int main()
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