diff options
| author | gingerBill <bill@gingerbill.org> | 2024-05-11 13:48:19 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-05-11 13:48:19 +0100 |
| commit | 811d53b305643607f25718437336c74dffdccb6b (patch) | |
| tree | dc922cbf913f09d722cf55ff632a5eea2b00f213 /src/check_type.cpp | |
| parent | aea28d5189848746725707d595155726b6b94ea0 (diff) | |
Generalize to any 1-byte element in `bit_field`
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 6fe87c2c7..88aa4ca1e 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1134,12 +1134,13 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type, }; Type *backing_type_elem = core_array_type(backing_type); + i64 backing_type_elem_size = type_size_of(backing_type_elem); EndianKind backing_type_endian_kind = determine_endian_kind(backing_type_elem); EndianKind endian_kind = Endian_Unknown; for (Entity *f : fields) { EndianKind field_kind = determine_endian_kind(f->type); - if (field_kind && backing_type_endian_kind != field_kind && backing_type_elem != t_u8) { + if (field_kind && backing_type_endian_kind != field_kind && backing_type_elem_size > 1) { error(f->token, "All 'bit_field' field types must match the same endian kind as the backing type, i.e. all native, all little, or all big"); } |