Debian Codegraph @

clang/test/SemaObjC/labeled-break-continue.m

raw
1 // RUN: %clang_cc1 -std=c2y -fsyntax-only -verify -fblocks %s
2
3 void f1(id y) {
4 l1: for (id x in y) {
5 break l1;
6 continue l1;
7 }
8
9 l2: for (id x in y) {
10 break l1; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
11 continue l1; // expected-error {{'continue' label does not name an enclosing loop}}
12 }
13
14 l3: for (id x in y) {
15 l4: for (id x in y) {
16 break l3;
17 break l4;
18 continue l3;
19 continue l4;
20 }
21 }
22 }
23
24 void f2(id y) {
25 l1: for (id x in ({
26 break l1; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
27 continue l1; // expected-error {{'continue' label does not name an enclosing loop}}
28 y;
29 })) {}
30 }
31
32 void f3(id y) {
33 a: b: for (id x in y) {
34 (void) ^{
35 break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
36 continue b; // expected-error {{'continue' label does not name an enclosing loop}}
37 };
38 }
39 }