aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-11-29 23:00:16 +0000
committergingerBill <bill@gingerbill.org>2018-11-29 23:00:16 +0000
commit784c48c9e36c11595b23fb0df002c063dd42a2bf (patch)
tree4c5c2c91e63031fb83601089eae2264c6e655e60 /src/ir.cpp
parent008d8f25c824d45096dfc23d1c741dba7babdff4 (diff)
Redefine how union tag size is calculated to match alignment of the union0.9.1
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index bcbcc83d6..608122afd 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7028,6 +7028,8 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) {
Type *fet = ir_type(field_expr);
// HACK TODO(bill): THIS IS A MASSIVE HACK!!!!
if (is_type_union(ft) && !are_types_identical(fet, ft) && !is_type_untyped(fet)) {
+ GB_ASSERT_MSG(union_variant_index(ft, fet) > 0, "%s", type_to_string(fet));
+
irValue *gep = ir_emit_struct_ep(proc, v, cast(i32)index);
ir_emit_store_union_variant(proc, gep, field_expr, fet);
} else {