zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit da2006a38c63ac84aa9a075193bd72cf2d1716a2 (tree)
parent 4f7344dec0bc61916f0c9af99bc5b5e5b7167da3
Author: Matthew Lugg <mlugg@mlugg.co.uk>
Date:   Sun,  8 Feb 2026 14:21:08 +0000

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.

Diffstat:
Mtest/behavior/union.zig | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/test/behavior/union.zig b/test/behavior/union.zig @@ -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;