| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-Wparentheses" } |
| 3 |
|
| 4 |
// C++ version of gcc.dg/Wparentheses-9.c |
| 5 |
|
| 6 |
int foo (int); |
| 7 |
|
| 8 |
int a, b, c; |
| 9 |
|
| 10 |
void |
| 11 |
bar (void) |
| 12 |
{ |
| 13 |
if (a) |
| 14 |
foo (0); |
| 15 |
if (b) |
| 16 |
foo (1); |
| 17 |
else |
| 18 |
foo (2); |
| 19 |
if (c) // { dg-warning "ambiguous" "correct warning" } |
| 20 |
if (a) |
| 21 |
foo (3); |
| 22 |
else |
| 23 |
foo (4); |
| 24 |
if (a) |
| 25 |
if (c) |
| 26 |
foo (5); |
| 27 |
if (a) |
| 28 |
if (b) // { dg-warning "ambiguous" "correct warning" } |
| 29 |
if (c) |
| 30 |
foo (6); |
| 31 |
else |
| 32 |
foo (7); |
| 33 |
if (a) // { dg-warning "ambiguous" "correct warning" } |
| 34 |
if (b) |
| 35 |
if (c) |
| 36 |
foo (8); |
| 37 |
else |
| 38 |
foo (9); |
| 39 |
else |
| 40 |
foo (10); |
| 41 |
if (a) |
| 42 |
if (b) |
| 43 |
if (c) |
| 44 |
foo (11); |
| 45 |
else |
| 46 |
foo (12); |
| 47 |
else |
| 48 |
foo (13); |
| 49 |
else |
| 50 |
foo (14); |
| 51 |
if (a) { |
| 52 |
if (b) |
| 53 |
if (c) |
| 54 |
foo (15); |
| 55 |
else |
| 56 |
foo (16); |
| 57 |
else |
| 58 |
foo (17); |
| 59 |
} |
| 60 |
} |