brintos

brintos / llvm-project-archived public Read only

0
0
Text · 498 B · ed95279 Raw
21 lines · c
1// RUN: %clang_cc1 -verify -Wunsequenced -Wno-unused-value %s2 3/* WG14 N1282: Yes4 * Clarification of Expressions5 */6 7int g;8 9int f(int i) {10  g = i;11  return 0;12}13 14int 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