mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
17 lines
378 B
Zig
17 lines
378 B
Zig
const std = @import("std");
|
|
const expectEqual = std.testing.expectEqual;
|
|
|
|
test "aligned struct fields" {
|
|
const S = struct {
|
|
a: u32 align(2),
|
|
b: u32 align(64),
|
|
};
|
|
var foo = S{ .a = 1, .b = 2 };
|
|
|
|
try expectEqual(64, @alignOf(S));
|
|
try expectEqual(*align(2) u32, @TypeOf(&foo.a));
|
|
try expectEqual(*align(64) u32, @TypeOf(&foo.b));
|
|
}
|
|
|
|
// test
|