mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-18 20:40:28 +00:00
Check for non-zero sized elements for intrinsics.ptr_sub
This commit is contained in:
@@ -4182,6 +4182,13 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *elem = type_deref(ptr0.type);
|
||||
if (type_size_of(elem) == 0) {
|
||||
gbString str = type_to_string(ptr0.type);
|
||||
error(ptr0.expr, "Expected a pointer to a non-zero sized element for '%.*s', got %s", LIT(builtin_name), str);
|
||||
gb_string_free(str);
|
||||
return false
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user