Skip to content

Commit

Permalink
Merge pull request #3925 from Feoramund/fix-no-return-switch
Browse files Browse the repository at this point in the history
Fix compiler crash when switching on no value
  • Loading branch information
Kelimion authored Jul 14, 2024
2 parents e7d3760 + b38237e commit 65dab3a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/check_stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,9 @@ gb_internal void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags
if (ss->tag != nullptr) {
check_expr(ctx, &x, ss->tag);
check_assignment(ctx, &x, nullptr, str_lit("switch expression"));
if (x.type == nullptr) {
return;
}
} else {
x.mode = Addressing_Constant;
x.type = t_bool;
Expand Down

0 comments on commit 65dab3a

Please sign in to comment.