1 // Test operation of -Wparentheses. Warnings for assignments used as
2 // truth-values. Essentially the same as gcc.dg/Wparentheses-3.c.
3 // Origin: Joseph Myers <jsm@polyomino.org.uk>
6 // { dg-options "-Wparentheses" }
16 if (a = b) // { dg-warning "assignment" "correct warning" }
20 if (a = a) // { dg-warning "assignment" "correct warning" }
24 if (b = c) // { dg-warning "assignment" "correct warning" }
32 if (b = b) // { dg-warning "assignment" "correct warning" }
40 while (c = b) // { dg-warning "assignment" "correct warning" }
44 while (c = c) // { dg-warning "assignment" "correct warning" }
48 do foo (16); while (a = b); // { dg-warning "assignment" "correct warning" }
49 do foo (17); while ((a = b));
50 do foo (18); while (a = a); // { dg-warning "assignment" "correct warning" }
51 do foo (19); while ((a = a));
52 for (;c = b;) // { dg-warning "assignment" "correct warning" }
56 for (;c = c;) // { dg-warning "assignment" "correct warning" }
60 d = a = b; // { dg-warning "assignment" "correct warning" }
64 d = a = a; // { dg-warning "assignment" "correct warning" }