Merge pull request #6925 from tf2spi/6923-check-untyped-to-union-conversion

Make checking of untyped to union conversions more strict
This commit is contained in:
gingerBill
2026-07-02 14:01:41 +01:00
committed by GitHub

View File

@@ -5169,16 +5169,12 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar
if (valid_count == 1) {
Type *new_type = t->Union.variants[first_success_index];
target_type = new_type;
if (is_type_union(new_type)) {
convert_to_typed(c, operand, new_type);
break;
}
operand->type = new_type;
if (operand->mode != Addressing_Constant ||
!elem_type_can_be_constant(operand->type)) {
!elem_type_can_be_constant(new_type)) {
operand->mode = Addressing_Value;
}
convert_to_typed(c, operand, new_type);
target_type = new_type;
break;
} else if (valid_count > 1) {
ERROR_BLOCK();