gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C
raw| 1 | // { dg-do compile } |
| 2 | |
| 3 | extern int j; |
| 4 | |
| 5 | void |
| 6 | f (int i) |
| 7 | { |
| 8 | switch (i) // { dg-warning "statement will never be executed" } |
| 9 | { |
| 10 | try |
| 11 | { |
| 12 | } |
| 13 | catch (...) |
| 14 | { |
| 15 | } |
| 16 | case 1:; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | g (int i) |
| 22 | { |
| 23 | switch (i) |
| 24 | { |
| 25 | try |
| 26 | { |
| 27 | j = 42; // { dg-warning "statement will never be executed" } |
| 28 | } |
| 29 | catch (...) |
| 30 | { |
| 31 | } |
| 32 | case 1:; |
| 33 | } |
| 34 | } |