mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
16 lines
324 B
Zig
16 lines
324 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
const S = packed struct {
|
|
a: u32,
|
|
b: u32,
|
|
};
|
|
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;
|
|
try expect(ptr_to_b.* == 2);
|
|
}
|
|
|
|
// test
|