diff options
| author | kcbanner <kcbanner@gmail.com> | 2023-09-23 13:03:03 -0400 |
|---|---|---|
| committer | kcbanner <kcbanner@gmail.com> | 2023-09-23 13:05:04 -0400 |
| commit | f2a24b48e1221a8954ddf16e9070e1470ee13e8d (patch) | |
| tree | 65443a1d67bb03be28927643462f92568fedbbc0 /src/codegen/spirv.zig | |
| parent | 2fddd767ba20374e7677003c101e60f470c3804c (diff) | |
| download | zig-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/spirv.zig')
| -rw-r--r-- | src/codegen/spirv.zig | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 8fb6153938..33a864ea0a 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -838,10 +838,7 @@ pub const DeclGen = struct { return dg.todo("packed union constants", .{}); } - const active_field = ty.unionTagFieldIndex(un.tag.toValue(), dg.module) orelse f: { - assert(union_obj.getLayout(ip) == .Extern); - break :f mod.unionLargestField(union_obj).index; - }; + const active_field = ty.unionTagFieldIndex(un.tag.toValue(), dg.module).?; const active_field_ty = union_obj.field_types.get(ip)[active_field].toType(); const has_tag = layout.tag_size != 0; |
