diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-09 14:07:07 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-09 14:07:07 +0100 |
| commit | ef7c6b98951aacc72bd25750e1c4a3a8c30c7d06 (patch) | |
| tree | e5aad4710964982f570ef0ab7a0a09c8172962c6 /src/check_expr.cpp | |
| parent | c17981ac38ace6cac12463029273d16068bf23c3 (diff) | |
Re Fix #3713
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 1e6d6e2ab..13d0e277d 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3350,6 +3350,9 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) { if (is_type_untyped(x->type)) { Type *final_type = type; if (is_const_expr && !is_type_constant_type(type)) { + if (is_type_union(type)) { + convert_to_typed(c, x, type); + } final_type = default_type(x->type); } update_untyped_expr_type(c, x->expr, final_type, true); @@ -4298,7 +4301,8 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar } else { switch (operand->type->Basic.kind) { case Basic_UntypedBool: - if (!is_type_boolean(target_type)) { + if (!is_type_boolean(target_type) && + !is_type_integer(target_type)) { operand->mode = Addressing_Invalid; convert_untyped_error(c, operand, target_type); return; |