Преглед на файлове

Fix compiler crash when switching on no value

Feoramund преди 1 година
родител
ревизия
b38237e8f0
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      src/check_stmt.cpp

+ 3 - 0
src/check_stmt.cpp

@@ -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;