From 2c308bdcfabe4aeaa51e007a683347f0546e6a1b Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 26 Jun 2025 17:05:12 +0200 Subject: [PATCH] fix load type panic because front-end allows a deref of a type Fixes #5357 --- src/check_expr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index fa1b4cd92..14d54af68 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -11323,6 +11323,13 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast node->viral_state_flags |= de->expr->viral_state_flags; if (o->mode == Addressing_Invalid) { + o->mode = Addressing_Invalid; + o->expr = node; + return kind; + } else if (o->mode == Addressing_Type) { + gbString str = expr_to_string(o->expr); + error(o->expr, "Cannot dereference '%s' because it is a type", str); + o->mode = Addressing_Invalid; o->expr = node; return kind;