tests: unions without fields need not store their tag at runtime

...because the union semantically has no possible value so cannot be
stored to or loaded from memory anyway.
This commit is contained in:
Matthew Lugg 2026-02-08 14:21:08 +00:00
parent d1d377a80c
commit 2b32c2748e
No known key found for this signature in database
GPG key ID: 3F5B7DCCBF4AF02E

View file

@ -1020,7 +1020,7 @@ test "containers with single-field enums" {
try comptime S.doTheTest();
}
test "@unionInit on union with tag but no fields" {
test "@unionInit on union with u8 tag but no fields" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
@ -1036,10 +1036,6 @@ test "@unionInit on union with tag but no fields" {
}
};
comptime {
assert(@sizeOf(Data) == 1);
}
fn doTheTest() !void {
var data: Data = .{ .no_op = {} };
_ = &data;