When I try to get the @sizeOf a packed struct with 2+4 bytes field, I'd expect to get 6 bytes, but get 8 bytes instead. Is my understanding of "packed" incorrect, or is there some bug here?
Tested on 0.10.0 and 0.11.0-dev.661+d88eb75a6 with identical behavior.
Minimal testcase:
test "packed" {
try std.testing.expectEqual(@as(usize, 2), @sizeOf(packed struct {a: u16})); // passes
try std.testing.expectEqual(@as(usize, 6), @sizeOf(packed struct {a: u16, b: u32})); // fails
}
Output:
Test [1/1] test.packed... expected 6, found 8
Test [1/1] test.packed... FAIL (TestExpectedEqual)