From f12d36641f67564d2103f75ed7a5445219197db5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 16 Nov 2017 10:06:58 -0500 Subject: union secret field is the tag index instead of distinct type index See #144 --- src/ir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 6df6b4f828..fa59aa03f2 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13158,7 +13158,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir return ira->codegen->builtin_types.entry_invalid; ConstExprValue *out_val = ir_build_const_from(ira, instruction); - out_val->data.x_union.value = field_val; + out_val->data.x_union.payload = field_val; + out_val->data.x_union.tag = type_field->value; ConstParent *parent = get_const_val_parent(ira->codegen, field_val); if (parent != nullptr) { -- cgit v1.2.3