The following code doesn't pass the final assert:
pub const TestStruct = union(SmallEnum) {
one: struct { a: u8, b: u32 },
two: struct { b: u32 },
};
pub const SmallEnum = enum(u8) { one, two };
comptime {
std.debug.assert(@sizeOf(TestStruct) == 8);
}
Why is @sizeOf(TestStruct) == 12 when in both union cases there is more than enough space to fit in the SmallEnum tag of u8 size into 8 bytes? Is this a compiler bug?