| 1 |
// Verify that there are no spurious warnings in nested switch statements due |
| 2 |
// to the unnecessary break in the inner switch block. |
| 3 |
// { dg-do compile } |
| 4 |
// { dg-options "-Wimplicit-fallthrough" } */ |
| 5 |
|
| 6 |
int |
| 7 |
foo (int c1, int c2, int c3) |
| 8 |
{ |
| 9 |
switch (c2) |
| 10 |
{ |
| 11 |
case 0: |
| 12 |
switch (c3) // { dg-bogus "may fall through" } |
| 13 |
{ |
| 14 |
case 0: |
| 15 |
if (c1) |
| 16 |
return 1; |
| 17 |
else |
| 18 |
return 2; |
| 19 |
break; |
| 20 |
|
| 21 |
default: |
| 22 |
return 3; |
| 23 |
} |
| 24 |
|
| 25 |
case 1: |
| 26 |
return 4; |
| 27 |
default: |
| 28 |
return 5; |
| 29 |
break; |
| 30 |
} |
| 31 |
} |