1 |
693 |
jeremybenn |
// { dg-do compile }
|
2 |
|
|
// { dg-options "-Wparentheses" }
|
3 |
|
|
|
4 |
|
|
// C++ version of gcc.dg/Wparentheses-8.c
|
5 |
|
|
|
6 |
|
|
int foo (int);
|
7 |
|
|
|
8 |
|
|
int
|
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 |
|
|
foo (a - b & c); // { dg-warning "parentheses" "correct warning" }
|
30 |
|
|
foo ((a - b) & c);
|
31 |
|
|
foo (a - (b & c));
|
32 |
|
|
foo (1 - 2 & c); // { dg-warning "parentheses" "correct warning" }
|
33 |
|
|
foo ((1 - 2) & c);
|
34 |
|
|
foo (1 - (2 & c));
|
35 |
|
|
foo (1 - 2 & 3); // { dg-warning "parentheses" "correct warning" }
|
36 |
|
|
foo ((1 - 2) & 3);
|
37 |
|
|
foo (1 - (2 & 3));
|
38 |
|
|
foo (a & b - c); // { dg-warning "parentheses" "correct warning" }
|
39 |
|
|
foo ((a & b) - c);
|
40 |
|
|
foo (a & (b - c));
|
41 |
|
|
foo (1 & 2 - c); // { dg-warning "parentheses" "correct warning" }
|
42 |
|
|
foo ((1 & 2) - c);
|
43 |
|
|
foo (1 & (2 - c));
|
44 |
|
|
foo (1 & 2 - 3); // { dg-warning "parentheses" "correct warning" }
|
45 |
|
|
foo ((1 & 2) - 3);
|
46 |
|
|
foo (1 & (2 - 3));
|
47 |
|
|
foo (a < b & c); // { dg-warning "parentheses" "correct warning" }
|
48 |
|
|
foo ((a < b) & c);
|
49 |
|
|
foo (a < (b & c));
|
50 |
|
|
foo (1 < 2 & c); // { dg-warning "parentheses" "correct warning" }
|
51 |
|
|
foo ((1 < 2) & c);
|
52 |
|
|
foo (1 < (2 & c));
|
53 |
|
|
foo (1 < 2 & 3); // { dg-warning "parentheses" "correct warning" }
|
54 |
|
|
foo ((1 < 2) & 3);
|
55 |
|
|
foo (1 < (2 & 3));
|
56 |
|
|
foo (a & b < c); // { dg-warning "parentheses" "correct warning" }
|
57 |
|
|
foo ((a & b) < c);
|
58 |
|
|
foo (a & (b < c));
|
59 |
|
|
foo (1 & 2 < c); // { dg-warning "parentheses" "correct warning" }
|
60 |
|
|
foo ((1 & 2) < c);
|
61 |
|
|
foo (1 & (2 < c));
|
62 |
|
|
foo (1 & 2 < 3); // { dg-warning "parentheses" "correct warning" }
|
63 |
|
|
foo ((1 & 2) < 3);
|
64 |
|
|
foo (1 & (2 < 3));
|
65 |
|
|
foo (a == b & c); // { dg-warning "parentheses" "correct warning" }
|
66 |
|
|
foo ((a == b) & c);
|
67 |
|
|
foo (a == (b & c));
|
68 |
|
|
foo (1 == 2 & c); // { dg-warning "parentheses" "correct warning" }
|
69 |
|
|
foo ((1 == 2) & c);
|
70 |
|
|
foo (1 == (2 & c));
|
71 |
|
|
foo (1 == 2 & 3); // { dg-warning "parentheses" "correct warning" }
|
72 |
|
|
foo ((1 == 2) & 3);
|
73 |
|
|
foo (1 == (2 & 3));
|
74 |
|
|
foo (a & b == c); // { dg-warning "parentheses" "correct warning" }
|
75 |
|
|
foo ((a & b) == c);
|
76 |
|
|
foo (a & (b == c));
|
77 |
|
|
foo (1 & 2 == c); // { dg-warning "parentheses" "correct warning" }
|
78 |
|
|
foo ((1 & 2) == c);
|
79 |
|
|
foo (1 & (2 == c));
|
80 |
|
|
foo (1 & 2 == 3); // { dg-warning "parentheses" "correct warning" }
|
81 |
|
|
foo ((1 & 2) == 3);
|
82 |
|
|
foo (1 & (2 == 3));
|
83 |
|
|
foo (a != b & c); // { dg-warning "parentheses" "correct warning" }
|
84 |
|
|
foo ((a != b) & c);
|
85 |
|
|
foo (a != (b & c));
|
86 |
|
|
foo (1 != 2 & c); // { dg-warning "parentheses" "correct warning" }
|
87 |
|
|
foo ((1 != 2) & c);
|
88 |
|
|
foo (1 != (2 & c));
|
89 |
|
|
foo (1 != 2 & 3); // { dg-warning "parentheses" "correct warning" }
|
90 |
|
|
foo ((1 != 2) & 3);
|
91 |
|
|
foo (1 != (2 & 3));
|
92 |
|
|
foo (a & b != c); // { dg-warning "parentheses" "correct warning" }
|
93 |
|
|
foo ((a & b) != c);
|
94 |
|
|
foo (a & (b != c));
|
95 |
|
|
foo (1 & 2 != c); // { dg-warning "parentheses" "correct warning" }
|
96 |
|
|
foo ((1 & 2) != c);
|
97 |
|
|
foo (1 & (2 != c));
|
98 |
|
|
foo (1 & 2 != 3); // { dg-warning "parentheses" "correct warning" }
|
99 |
|
|
foo ((1 & 2) != 3);
|
100 |
|
|
foo (1 & (2 != 3));
|
101 |
|
|
}
|