aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index d2ea876065..adc4035482 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -6436,10 +6436,15 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue {
try f.writeCValue(writer, local, .Other);
try writer.print(".tag = {}; ", .{try f.fmtIntLiteral(tag_ty, int_val)});
}
+ try f.writeCValue(writer, local, .Other);
+ try writer.print(".payload.{ } = ", .{fmtIdent(field_name)});
+ try f.writeCValue(writer, payload, .Other);
+ try writer.writeAll(";\n");
+ return local;
}
try f.writeCValue(writer, local, .Other);
- try writer.print(".payload.{ } = ", .{fmtIdent(field_name)});
+ try writer.print(".{ } = ", .{fmtIdent(field_name)});
try f.writeCValue(writer, payload, .Other);
try writer.writeAll(";\n");