mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
langref: don't assume too much about pointer to packed struct field
This commit is contained in:
parent
725dec6aa7
commit
d7d50496d9
1 changed files with 1 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ const S = packed struct {
|
||||||
test "overaligned pointer to packed struct" {
|
test "overaligned pointer to packed struct" {
|
||||||
var foo: S align(4) = .{ .a = 1, .b = 2 };
|
var foo: S align(4) = .{ .a = 1, .b = 2 };
|
||||||
const ptr: *align(4) S = &foo;
|
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);
|
try expect(ptr_to_b.* == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue