aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-09-23 13:03:03 -0400
committerkcbanner <kcbanner@gmail.com>2023-09-23 13:05:04 -0400
commitf2a24b48e1221a8954ddf16e9070e1470ee13e8d (patch)
tree65443a1d67bb03be28927643462f92568fedbbc0 /src/codegen/c.zig
parent2fddd767ba20374e7677003c101e60f470c3804c (diff)
downloadzig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.tar.gz
zig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.zip
sema: rework the comptime representation of comptime unions
When the tag is not known, it's set to `.none`. In this case, the value is either an array of bytes (for extern unions) or an integer (for packed unions).
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 0b634e5038..54e13db9a1 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -1439,10 +1439,7 @@ pub const DeclGen = struct {
}
const union_obj = mod.typeToUnion(ty).?;
- const field_i = mod.unionTagFieldIndex(union_obj, un.tag.toValue()) orelse f: {
- assert(union_obj.getLayout(ip) == .Extern);
- break :f mod.unionLargestField(union_obj).index;
- };
+ const field_i = mod.unionTagFieldIndex(union_obj, un.tag.toValue()).?;
const field_ty = union_obj.field_types.get(ip)[field_i].toType();
const field_name = union_obj.field_names.get(ip)[field_i];
if (union_obj.getLayout(ip) == .Packed) {