| 1 |
/* N3355 - Named loops. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-std=c2y -Wall" } */ |
| 4 |
|
| 5 |
void |
| 6 |
foo (int x) |
| 7 |
{ |
| 8 |
lab0: |
| 9 |
switch (x) |
| 10 |
{ |
| 11 |
case 1: |
| 12 |
++x; |
| 13 |
[[fallthrough]]; |
| 14 |
lab1: /* { dg-warning "label 'lab1' defined but not used" } */ |
| 15 |
case 2: |
| 16 |
[[fallthrough]]; |
| 17 |
case 3: |
| 18 |
lab2: |
| 19 |
for (int i = 0; i < 4; ++i) |
| 20 |
if (i == 0) |
| 21 |
continue lab2; |
| 22 |
else if (i == 1) |
| 23 |
continue lab1; /* { dg-error "'continue' statement operand 'lab1' does not refer to a named loop; did you mean 'lab2'\\\?" } */ |
| 24 |
else if (x == 2) |
| 25 |
break lab1; /* { dg-error "'break' statement operand 'lab1' does not refer to a named loop or 'switch'; did you mean 'lab2'\\\?" } */ |
| 26 |
else |
| 27 |
break lab0; |
| 28 |
break; |
| 29 |
default: |
| 30 |
break; |
| 31 |
} |
| 32 |
} |