Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wparentheses-8.C

raw
1 // { dg-do compile }
2 // { dg-options "-Wparentheses" }
3
4 // C++ version of gcc.dg/Wparentheses-5.c
5
6 int foo (int);
7
8 void
9 bar (int a, int b, int c)
10 {
11 foo (a && b || c); // { dg-warning "parentheses" "correct warning" }
12 foo ((a && b) || c);
13 foo (a && (b || c));
14 foo (1 && 2 || c); // { dg-warning "parentheses" "correct warning" }
15 foo ((1 && 2) || c);
16 foo (1 && (2 || c));
17 foo (1 && 2 || 3); // { dg-warning "parentheses" "correct warning" }
18 foo ((1 && 2) || 3);
19 foo (1 && (2 || 3));
20 foo (a || b && c); // { dg-warning "parentheses" "correct warning" }
21 foo ((a || b) && c);
22 foo (a || (b && c));
23 foo (1 || 2 && c); // { dg-warning "parentheses" "correct warning" }
24 foo ((1 || 2) && c);
25 foo (1 || (2 && c));
26 foo (1 || 2 && 3); // { dg-warning "parentheses" "correct warning" }
27 foo ((1 || 2) && 3);
28 foo (1 || (2 && 3));
29 }