langref: don't assume too much about pointer to packed struct field

This commit is contained in:
Andrew Kelley 2025-09-10 02:08:11 -07:00
parent 725dec6aa7
commit d7d50496d9

View File

@ -8,7 +8,7 @@ const S = packed struct {
test "overaligned pointer to packed struct" {
var foo: S align(4) = .{ .a = 1, .b = 2 };
const ptr: *align(4) S = &foo;
const ptr_to_b: *u32 = &ptr.b;
const ptr_to_b = &ptr.b;
try expect(ptr_to_b.* == 2);
}