| ... | @@ -3539,7 +3539,29 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { | ... | @@ -3539,7 +3539,29 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { |
| 3539 | union_type->abi_size = SIZE_MAX; | 3539 | union_type->abi_size = SIZE_MAX; |
| 3540 | union_type->size_in_bits = SIZE_MAX; | 3540 | union_type->size_in_bits = SIZE_MAX; |
| 3541 | } | 3541 | } |
| 3542 | union_type->data.unionation.resolve_status = zero_bits ? ResolveStatusSizeKnown : ResolveStatusZeroBitsKnown; | 3542 | |
| | 3543 | if (zero_bits) { |
| | 3544 | // Don't forget to resolve the types for each union member even though |
| | 3545 | // the type is zero sized. |
| | 3546 | // XXX: Do it in a nicer way in stage2. |
| | 3547 | union_type->data.unionation.resolve_loop_flag_other = true; |
| | 3548 | |
| | 3549 | for (uint32_t i = 0; i < field_count; i += 1) { |
| | 3550 | TypeUnionField *union_field = &union_type->data.unionation.fields[i]; |
| | 3551 | ZigType *field_type = resolve_union_field_type(g, union_field); |
| | 3552 | if (field_type == nullptr) { |
| | 3553 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| | 3554 | return ErrorSemanticAnalyzeFail; |
| | 3555 | } |
| | 3556 | } |
| | 3557 | |
| | 3558 | union_type->data.unionation.resolve_loop_flag_other = false; |
| | 3559 | union_type->data.unionation.resolve_status = ResolveStatusSizeKnown; |
| | 3560 | |
| | 3561 | return ErrorNone; |
| | 3562 | } |
| | 3563 | |
| | 3564 | union_type->data.unionation.resolve_status = ResolveStatusZeroBitsKnown; |
| 3543 | | 3565 | |
| 3544 | return ErrorNone; | 3566 | return ErrorNone; |
| 3545 | } | 3567 | } |