2017-06-16 11:47:05 +08:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
const builtin = @import("builtin");
|
|
|
|
|
2018-05-01 08:35:54 +08:00
|
|
|
const Foo = struct {
|
|
|
|
x: u32,
|
|
|
|
y: u32,
|
|
|
|
z: u32,
|
|
|
|
};
|
2017-06-16 11:47:05 +08:00
|
|
|
|
2017-08-29 19:30:22 +08:00
|
|
|
test "@alignOf(T) before referencing T" {
|
|
|
|
comptime assert(@alignOf(Foo) != @maxValue(usize));
|
2017-06-16 11:47:05 +08:00
|
|
|
if (builtin.arch == builtin.Arch.x86_64) {
|
2017-08-29 19:30:22 +08:00
|
|
|
comptime assert(@alignOf(Foo) == 4);
|
2017-06-16 11:47:05 +08:00
|
|
|
}
|
|
|
|
}
|