blob: 78f81c484c3d50bf5e98d634f52878855339faa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
// RUN: %clang_cc1 -std=c2y -verify -fsyntax-only -fblocks %s
// RUN: %clang_cc1 -std=c23 -verify -fsyntax-only -fblocks -fnamed-loops %s
// RUN: %clang_cc1 -x c++ -verify -fsyntax-only -fblocks -fnamed-loops %s
void f1() {
l1: while (true) {
break l1;
continue l1;
}
l2: for (;;) {
break l2;
continue l2;
}
l3: do {
break l3;
continue l3;
} while (true);
l4: switch (1) {
case 1:
break l4;
}
}
void f2() {
l1:;
break l1; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue l1; // expected-error {{'continue' label does not name an enclosing loop}}
l2: while (true) {
break l1; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue l1; // expected-error {{'continue' label does not name an enclosing loop}}
}
while (true) {
break l2; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue l2; // expected-error {{'continue' label does not name an enclosing loop}}
}
break l3; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue l3; // expected-error {{'continue' label does not name an enclosing loop}}
l3: while (true) {}
}
void f3() {
a: b: c: d: while (true) {
break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break c; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break d;
continue a; // expected-error {{'continue' label does not name an enclosing loop}}
continue b; // expected-error {{'continue' label does not name an enclosing loop}}
continue c; // expected-error {{'continue' label does not name an enclosing loop}}
continue d;
e: while (true) {
break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break c; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
break d;
break e;
continue a; // expected-error {{'continue' label does not name an enclosing loop}}
continue b; // expected-error {{'continue' label does not name an enclosing loop}}
continue c; // expected-error {{'continue' label does not name an enclosing loop}}
continue d;
continue e;
}
break e; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue e; // expected-error {{'continue' label does not name an enclosing loop}}
}
}
void f4() {
a: switch (1) {
case 1: {
continue a; // expected-error {{label of 'continue' refers to a switch statement}}
}
}
}
void f5() {
a: {
break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
}
b: {
while (true)
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
}
}
void f6() {
a: while (({
break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue a; // expected-error {{'continue' label does not name an enclosing loop}}
1;
})) {
({ break a; });
({ continue a; });
}
b: for (
int x = ({
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue b; // expected-error {{'continue' label does not name an enclosing loop}}
1;
});
({
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue b; // expected-error {{'continue' label does not name an enclosing loop}}
1;
});
(void) ({
break b; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue b; // expected-error {{'continue' label does not name an enclosing loop}}
1;
})
) {
({ break b; });
({ continue b; });
}
c: do {
({ break c; });
({ continue c; });
} while (({
break c; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue c; // expected-error {{'continue' label does not name an enclosing loop}}
1;
}));
d: switch (({
break d; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue d; // expected-error {{'continue' label does not name an enclosing loop}}
1;
})) {
case 1: {
({ break d; });
({ continue d; }); // expected-error {{label of 'continue' refers to a switch statement}}
}
}
}
void f7() {
a: while (true) {
(void) ^{
break a; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue a; // expected-error {{'continue' label does not name an enclosing loop}}
};
}
while (true) {
break c; // expected-error {{'break' label does not name an enclosing loop or 'switch'}}
continue d; // expected-error {{'continue' label does not name an enclosing loop}}
}
}
|