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