| 1 | const std = @import("std"); |
| 2 | const expectEqual = std.testing.expectEqual; |
| 3 | |
| 4 | const S = packed struct { |
| 5 | a: u32, |
| 6 | b: u32, |
| 7 | }; |
| 8 | test "overaligned pointer to packed struct" { |
| 9 | var foo: S align(4) = .{ .a = 1, .b = 2 }; |
| 10 | const ptr: *align(4) S = &foo; |
| 11 | const ptr_to_b = &ptr.b; |
| 12 | try expectEqual(2, ptr_to_b.*); |
| 13 | } |
| 14 | |
| 15 | // test |