diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-09 10:25:48 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-09 10:25:48 +0100 |
| commit | a60058259d9ae6bbff37fff49e53d542354c90c1 (patch) | |
| tree | 82b3f8c60789a9e93b4feb272478b19d0351f73a /src/check_builtin.cpp | |
| parent | 41c523faa5a66232239e1f0ea262a6721eefc3b9 (diff) | |
Allow `intrinsics.type_union_tag_offset` with maybe-like unions
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 0f8944cb9..5d1016bba 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -6742,9 +6742,13 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As // NOTE(jakubtomsu): forces calculation of variant_block_size type_size_of(u); - // 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); + if (u->Union.tag_size == 0) { + GB_ASSERT(is_type_union_maybe_pointer(u)); + } 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->type = t_untyped_integer; |