aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2025-06-26 17:05:12 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2025-06-26 17:07:06 +0200
commit2c308bdcfabe4aeaa51e007a683347f0546e6a1b (patch)
treee1cec0b1e4e932b96aa990501081acfe1056bc74
parent88c208d1fbbaa250adb07637b3002d4df38af962 (diff)
fix load type panic because front-end allows a deref of a type
Fixes #5357
-rw-r--r--src/check_expr.cpp7
1 files changed, 7 insertions, 0 deletions
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
@@ -11326,6 +11326,13 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
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;
} else {
Type *t = base_type(o->type);
if (t->kind == Type_Pointer && !is_type_empty_union(t->Pointer.elem)) {