From 54138d9e82d545094a85435ef862a6d4894e859e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 4 Dec 2017 02:05:33 -0500 Subject: [PATCH] add test for union with 1 void field being 0 bits --- test/cases/union.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/cases/union.zig b/test/cases/union.zig index fb0ca1238d..13bc084551 100644 --- a/test/cases/union.zig +++ b/test/cases/union.zig @@ -166,3 +166,10 @@ const PackedPtrOrInt = packed union { test "extern union size" { comptime assert(@sizeOf(PackedPtrOrInt) == 8); } + +const ZeroBits = union { + OnlyField: void, +}; +test "union with only 1 field which is void should be zero bits" { + comptime assert(@sizeOf(ZeroBits) == 0); +}