mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add better error message for trying to dereference a multi-pointer
This commit is contained in:
@@ -9310,7 +9310,15 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
|||||||
} else {
|
} else {
|
||||||
gbString str = expr_to_string(o->expr);
|
gbString str = expr_to_string(o->expr);
|
||||||
gbString typ = type_to_string(o->type);
|
gbString typ = type_to_string(o->type);
|
||||||
|
begin_error_block();
|
||||||
|
|
||||||
error(o->expr, "Cannot dereference '%s' of type '%s'", str, typ);
|
error(o->expr, "Cannot dereference '%s' of type '%s'", str, typ);
|
||||||
|
if (o->type && is_type_multi_pointer(o->type)) {
|
||||||
|
error_line("\tDid you mean '%s[0]'?\n", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
end_error_block();
|
||||||
|
|
||||||
gb_string_free(typ);
|
gb_string_free(typ);
|
||||||
gb_string_free(str);
|
gb_string_free(str);
|
||||||
o->mode = Addressing_Invalid;
|
o->mode = Addressing_Invalid;
|
||||||
|
|||||||
Reference in New Issue
Block a user