xref: /llvm-project/clang/test/C/C11/n1282.c (revision d231e3b10ead90e4360f7ceb88e4bca9d42d7d04)
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 
f(int i)9 int f(int i) {
10   g = i;
11   return 0;
12 }
13 
main(void)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 }
21