diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4618bf969..1fc6eeb52 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1794,6 +1794,13 @@ gb_internal bool check_unary_op(CheckerContext *c, Operand *o, Token op) { gb_string_free(str); return false; } + if (o->mode == Addressing_Type) { + gbString str = type_to_string(o->type); + error(o->expr, "Expected an expression for operator '%.*s', got type '%s'", LIT(op.string), str); + gb_string_free(str); + return false; + } + Type *type = base_type(core_array_type(o->type)); gbString str = nullptr; switch (op.kind) {