| 1 |
// RUN: %clang_cc1 -verify -Wunsequenced -Wno-unused-value %s |
| 2 |
|
| 3 |
/* WG14 N1282: Yes |
| 4 |
* Clarification of Expressions |
| 5 |
*/ |
| 6 |
|
| 7 |
int g; |
| 8 |
|
| 9 |
int f(int i) { |
| 10 |
g = i; |
| 11 |
return 0; |
| 12 |
} |
| 13 |
|
| 14 |
int main(void) { |
| 15 |
int x; |
| 16 |
x = (10, g = 1, 20) + (30, g = 2, 40); /* Line A */ // expected-warning {{multiple unsequenced modifications to 'g'}} |
| 17 |
x = (10, f(1), 20) + (30, f(2), 40); /* Line B */ |
| 18 |
x = (g = 1) + (g = 2); /* Line C */ // expected-warning {{multiple unsequenced modifications to 'g'}} |
| 19 |
return 0; |
| 20 |
} |