| ... | @@ -166,3 +166,10 @@ const PackedPtrOrInt = packed union { | ... | @@ -166,3 +166,10 @@ const PackedPtrOrInt = packed union { |
| 166 | test "extern union size" { | 166 | test "extern union size" { |
| 167 | comptime assert(@sizeOf(PackedPtrOrInt) == 8); | 167 | comptime assert(@sizeOf(PackedPtrOrInt) == 8); |
| 168 | } | 168 | } |
| | 169 | |
| | 170 | const ZeroBits = union { |
| | 171 | OnlyField: void, |
| | 172 | }; |
| | 173 | test "union with only 1 field which is void should be zero bits" { |
| | 174 | comptime assert(@sizeOf(ZeroBits) == 0); |
| | 175 | } |