diff options
| author | Laytan <laytanlaats@hotmail.com> | 2025-06-26 17:32:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 17:32:07 +0200 |
| commit | 5822b00c3925a15a28d9ecc182040c680de36d04 (patch) | |
| tree | e1cec0b1e4e932b96aa990501081acfe1056bc74 | |
| parent | 88c208d1fbbaa250adb07637b3002d4df38af962 (diff) | |
| parent | 2c308bdcfabe4aeaa51e007a683347f0546e6a1b (diff) | |
Merge pull request #5411 from laytan/fix-load-type-panic
fix load type panic because front-end allows a deref of a type
| -rw-r--r-- | src/check_expr.cpp | 7 |
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)) { |