diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-22 18:15:13 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-22 18:15:13 +0000 |
| commit | 5f001f6d5138d61fbb4900c951e2ccb12894d5ed (patch) | |
| tree | 829a51ce3f0cdf40ecab46c885b7a48f8ae71602 /src/check_expr.cpp | |
| parent | fc07211772e37865c928a12ab01663baa940cf28 (diff) | |
Allow casting between a `bit_field` and its backing type
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index aba2f5831..792e5b43c 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2908,6 +2908,13 @@ gb_internal bool check_is_castable_to(CheckerContext *c, Operand *operand, Type } } + if (is_type_bit_field(src)) { + return are_types_identical(core_type(src->BitField.backing_type), dst); + } + if (is_type_bit_field(dst)) { + return are_types_identical(src, core_type(dst->BitField.backing_type)); + } + if (is_type_integer(src) && is_type_rune(dst)) { return true; } |