mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-17 16:38:22 +00:00
Allow casting between a bit_field and its backing type
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user