From da2006a38c63ac84aa9a075193bd72cf2d1716a2 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sun, 8 Feb 2026 14:21:08 +0000 Subject: [PATCH] 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. --- test/behavior/union.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/behavior/union.zig b/test/behavior/union.zig index a7b7c20a361d192a034363cc64a06ecc1f2b572a..1760f02c2299cf774153c64f24b76151249830e9 100644 --- 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; -- 2.54.0