mirror of
https://github.com/ziglang/zig.git
synced 2025-12-30 01:53:16 +00:00
Under some architecture/operating system combinations it is forbidden to return a pointer from a merge, as these pointers must point to a location at compile time. This adds a check for those cases when returning a pointer from a block merge.
17 lines
308 B
Zig
17 lines
308 B
Zig
export fn a() void {
|
|
var x: *addrspace(.global) i32 = undefined;
|
|
_ = &x;
|
|
var y: *addrspace(.global) i32 = undefined;
|
|
_ = &y;
|
|
var rt_cond = false;
|
|
_ = &rt_cond;
|
|
|
|
var z = if (rt_cond) x else y;
|
|
_ = &z;
|
|
}
|
|
|
|
// compile
|
|
// output_mode=Obj
|
|
// backend=stage2
|
|
// target=spirv64-vulkan
|