#zig build-obj {
--name test -fno-emit-bin
-target spirv64-vulkan -mcpu vulkan_v1_2+int64 -fno-llvm
-Mroot=test.zig
#}

#write test.zig {
const RuntimeElement = extern struct { a: u64 align(4), b: u32 };
const RuntimeArray = @SpirvType(.{ .runtime_array = RuntimeElement });
const RuntimeBlock = extern struct { values: RuntimeArray };
const Compatible = extern struct { values: [2]@Vector(4, u32) };
const Underaligned = extern struct { a: u32, b: u64 align(4) };
const SmallArray = extern struct { data: [2]u32 };
const Nested = extern struct { x: u32 };
const Misplaced = extern struct { first: Nested, second: u32 };
const Straddles = extern struct { x: [3]u32, vector: @Vector(2, u32) align(4) };

extern var push: Underaligned addrspace(.push_constant);

comptime {
    _ = @extern(*addrspace(.storage_buffer) Underaligned, .{ .name = "under" });
}
comptime {
    _ = @extern(*addrspace(.uniform) [4]SmallArray, .{ .name = "small" });
}
comptime {
    _ = @extern(*addrspace(.uniform) Misplaced, .{ .name = "nested" });
}
comptime {
    _ = @extern(*addrspace(.storage_buffer) Straddles, .{ .name = "straddles" });
}
comptime {
    _ = @extern(*addrspace(.storage_buffer) RuntimeBlock, .{ .name = "runtime" });
}
comptime {
    _ = &push;
}
comptime {
    _ = @extern(*addrspace(.uniform) Compatible, .{ .name = "compatible" });
    _ = @extern(*addrspace(.storage_buffer) SmallArray, .{ .name = "small_storage" });
}
comptime {
    const Unsupported = extern struct { data: @Vector(5, u32) };
    _ = @extern(*addrspace(.storage_buffer) Unsupported, .{ .name = "unsupported" });
}
comptime {
    const Wide = extern struct { first: u64, vector: @Vector(3, u64) align(8) };
    _ = @extern(*addrspace(.storage_buffer) Wide, .{ .name = "wide" });
}
#}
#update
#check errors {
test.zig:11:18: error: struct field "b" must be aligned to 8 bytes
test.zig:11:18: note: vulkan restricts the memory layout of types used with "push_constant" address space
test.zig:5:29: note: struct declared here
test.zig:14:17: error: struct field "b" must be aligned to 8 bytes
test.zig:14:17: note: vulkan restricts the memory layout of types used with "storage_buffer" address space
test.zig:5:29: note: struct declared here
test.zig:17:17: error: array stride of "[2]u32" must be a multiple of 16 bytes
test.zig:17:17: note: vulkan restricts the memory layout of types used with "uniform" address space
test.zig:20:17: error: struct field "second" must start at byte offset 16 or later
test.zig:20:17: note: vulkan restricts the memory layout of types used with "uniform" address space
test.zig:8:26: note: struct declared here
test.zig:23:17: error: struct field "vector" of vector type must fit within one 16-byte block
test.zig:23:17: note: vulkan restricts the memory layout of types used with "storage_buffer" address space
test.zig:9:26: note: struct declared here
test.zig:26:17: error: array stride of "@SpirvType(.runtime_array, test.RuntimeElement)" must be a multiple of 8 bytes
test.zig:26:17: note: vulkan restricts the memory layout of types used with "storage_buffer" address space
test.zig:37:17: error: type "@Vector(5, u32)" cannot be used with this address
test.zig:37:17: note: vulkan restricts the memory layout of types used with "storage_buffer" address space
test.zig:41:17: error: struct field "vector" of vector type must start at an offset divisible by 16
test.zig:41:17: note: vulkan restricts the memory layout of types used with "storage_buffer" address space
test.zig:40:25: note: struct declared here
#}
