mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Allow intrinsics.type_union_tag_offset with maybe-like unions
This commit is contained in:
@@ -6742,9 +6742,13 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
|||||||
|
|
||||||
// NOTE(jakubtomsu): forces calculation of variant_block_size
|
// NOTE(jakubtomsu): forces calculation of variant_block_size
|
||||||
type_size_of(u);
|
type_size_of(u);
|
||||||
// NOTE(Jeroen): A tag offset of zero is perfectly fine if all members of the union are empty structs.
|
if (u->Union.tag_size == 0) {
|
||||||
// What matters is that the tag size is > 0.
|
GB_ASSERT(is_type_union_maybe_pointer(u));
|
||||||
GB_ASSERT(u->Union.tag_size > 0);
|
} else {
|
||||||
|
// NOTE(Jeroen): A tag offset of zero is perfectly fine if all members of the union are empty structs.
|
||||||
|
// What matters is that the tag size is > 0.
|
||||||
|
GB_ASSERT(u->Union.tag_size > 0);
|
||||||
|
}
|
||||||
|
|
||||||
operand->mode = Addressing_Constant;
|
operand->mode = Addressing_Constant;
|
||||||
operand->type = t_untyped_integer;
|
operand->type = t_untyped_integer;
|
||||||
|
|||||||
Reference in New Issue
Block a user