zig/test/cases/alignof.zig
Jimmi Holst Christensen 378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00

16 lines
340 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);
}
}