mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
stage1: Initialize single-element union tag correctly
Use the field value instead of defaulting to zero.
This commit is contained in:
parent
865d6df03e
commit
0f7954831a
@ -6113,7 +6113,7 @@ ZigValue *get_the_one_possible_value(CodeGen *g, ZigType *type_entry) {
|
||||
TypeUnionField *only_field = &union_type->data.unionation.fields[0];
|
||||
ZigType *field_type = resolve_union_field_type(g, only_field);
|
||||
assert(field_type);
|
||||
bigint_init_unsigned(&result->data.x_union.tag, 0);
|
||||
bigint_init_bigint(&result->data.x_union.tag, &only_field->enum_field->value);
|
||||
result->data.x_union.payload = g->pass1_arena->create<ZigValue>();
|
||||
copy_const_val(g, result->data.x_union.payload,
|
||||
get_the_one_possible_value(g, field_type));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user