mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 07:13:14 +00:00
Fix #651
This commit is contained in:
@@ -2380,9 +2380,15 @@ bool check_cast_internal(CheckerContext *c, Operand *x, Type *type) {
|
||||
if (core_type(bt)->kind == Type_Basic) {
|
||||
if (check_representable_as_constant(c, x->value, bt, &x->value)) {
|
||||
return true;
|
||||
} else if (is_type_pointer(type) && check_is_castable_to(c, x, type)) {
|
||||
return true;
|
||||
} else if (check_is_castable_to(c, x, type)) {
|
||||
if (is_type_pointer(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (check_is_castable_to(c, x, type)) {
|
||||
x->value = {};
|
||||
x->mode = Addressing_Value;
|
||||
return true;
|
||||
}
|
||||
} else if (check_is_castable_to(c, x, type)) {
|
||||
if (x->mode != Addressing_Constant) {
|
||||
@@ -2392,6 +2398,9 @@ bool check_cast_internal(CheckerContext *c, Operand *x, Type *type) {
|
||||
} else if (is_type_union(type)) {
|
||||
x->mode = Addressing_Value;
|
||||
}
|
||||
if (x->mode == Addressing_Value) {
|
||||
x->value = {};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user