| ... | ... | @@ -3484,7 +3484,29 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { |
| 3484 | 3484 | union_type->abi_size = SIZE_MAX; |
| 3485 | 3485 | union_type->size_in_bits = SIZE_MAX; |
| 3486 | 3486 | } |
| 3487 | | union_type->data.unionation.resolve_status = zero_bits ? ResolveStatusSizeKnown : ResolveStatusZeroBitsKnown; |
| 3487 | |
| 3488 | if (zero_bits) { |
| 3489 | // Don't forget to resolve the types for each union member even though |
| 3490 | // the type is zero sized. |
| 3491 | // XXX: Do it in a nicer way in stage2. |
| 3492 | union_type->data.unionation.resolve_loop_flag_other = true; |
| 3493 | |
| 3494 | for (uint32_t i = 0; i < field_count; i += 1) { |
| 3495 | TypeUnionField *union_field = &union_type->data.unionation.fields[i]; |
| 3496 | ZigType *field_type = resolve_union_field_type(g, union_field); |
| 3497 | if (field_type == nullptr) { |
| 3498 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| 3499 | return ErrorSemanticAnalyzeFail; |
| 3500 | } |
| 3501 | } |
| 3502 | |
| 3503 | union_type->data.unionation.resolve_loop_flag_other = false; |
| 3504 | union_type->data.unionation.resolve_status = ResolveStatusSizeKnown; |
| 3505 | |
| 3506 | return ErrorNone; |
| 3507 | } |
| 3508 | |
| 3509 | union_type->data.unionation.resolve_status = ResolveStatusZeroBitsKnown; |
| 3488 | 3510 | |
| 3489 | 3511 | return ErrorNone; |
| 3490 | 3512 | } |