File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -292,8 +292,9 @@ bool ByteCodeStmtGen<Emitter>::visitStmt(const Stmt *S) {
292
292
case Stmt::GCCAsmStmtClass:
293
293
case Stmt::MSAsmStmtClass:
294
294
case Stmt::GotoStmtClass:
295
- case Stmt::LabelStmtClass:
296
295
return this ->emitInvalid (S);
296
+ case Stmt::LabelStmtClass:
297
+ return this ->visitStmt (cast<LabelStmt>(S)->getSubStmt ());
297
298
default : {
298
299
if (auto *Exp = dyn_cast<Expr>(S))
299
300
return this ->discard (Exp);
Original file line number Diff line number Diff line change @@ -157,3 +157,16 @@ namespace VirtualBases {
157
157
D d;
158
158
}
159
159
}
160
+
161
+ namespace LabelGoto {
162
+ constexpr int foo () { // all20-error {{never produces a constant expression}}
163
+ a: // all20-warning {{use of this statement in a constexpr function is a C++23 extension}}
164
+ goto a; // all20-note 2{{subexpression not valid in a constant expression}} \
165
+ // ref23-note {{subexpression not valid in a constant expression}} \
166
+ // expected23-note {{subexpression not valid in a constant expression}}
167
+
168
+ return 1 ;
169
+ }
170
+ static_assert (foo() == 1 , " " ); // all-error {{not an integral constant expression}} \
171
+ // all-note {{in call to}}
172
+ }
You can’t perform that action at this time.
0 commit comments