Skip to content

Commit 65f94d7

Browse files
authored
[clang][bytecode] Don't crash on erroneous switch conditions (#147533)
Not attaching a test since I've only seen this when compiling a large c++26 test case as c++17.
1 parent acdf1c7 commit 65f94d7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5629,6 +5629,9 @@ bool Compiler<Emitter>::visitContinueStmt(const ContinueStmt *S) {
56295629
template <class Emitter>
56305630
bool Compiler<Emitter>::visitSwitchStmt(const SwitchStmt *S) {
56315631
const Expr *Cond = S->getCond();
5632+
if (Cond->containsErrors())
5633+
return false;
5634+
56325635
PrimType CondT = this->classifyPrim(Cond->getType());
56335636
LocalScope<Emitter> LS(this);
56345637

0 commit comments

Comments
 (0)