zig/test/cases/alignof.zig
Andrew Kelley 865b53f286 fix alignOf builtin
* fix assertion error when type is not yet complete
 * fix alignment value

closes #391
2017-06-15 23:47:05 -04:00

12 lines
328 B
Zig

const assert = @import("std").debug.assert;
const builtin = @import("builtin");
const Foo = struct { x: u32, y: u32, z: u32, };
test "@alignOf(T) before referencing T" {
comptime assert(@alignOf(Foo) != @maxValue(usize));
if (builtin.arch == builtin.Arch.x86_64) {
comptime assert(@alignOf(Foo) == 4);
}
}