mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
langref: don't assume too much about pointer to packed struct field
This commit is contained in:
parent
725dec6aa7
commit
d7d50496d9
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user