| 1 |
/* PR c/49859 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wswitch-unreachable" } */ |
| 4 |
|
| 5 |
extern void foo (int); |
| 6 |
extern int j; |
| 7 |
|
| 8 |
void |
| 9 |
fn0 (int i) |
| 10 |
{ |
| 11 |
switch (i) |
| 12 |
{ |
| 13 |
int t = 10; /* { dg-warning "statement will never be executed" } */ |
| 14 |
default: |
| 15 |
foo (t); |
| 16 |
} |
| 17 |
|
| 18 |
switch (i) |
| 19 |
{ /* { dg-warning "statement will never be executed" } */ |
| 20 |
int A[i]; |
| 21 |
default: /* { dg-error "switch jumps into scope" } */ |
| 22 |
break; |
| 23 |
} |
| 24 |
|
| 25 |
switch (i) |
| 26 |
default: |
| 27 |
j = sizeof (struct { int i; }); |
| 28 |
|
| 29 |
switch (i) |
| 30 |
{ |
| 31 |
int A[3]; |
| 32 |
default: |
| 33 |
break; |
| 34 |
} |
| 35 |
} |