mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
This is all of the expected 0.14.0 progress on #21530, which can now be postponed once this commit is merged. This required rewriting the (un)wrap operations since the original implementations were extremely buggy. Also adds an easy way to retrigger Sema OPV bugs so that I don't have to keep updating #22419 all the time.
23 lines
350 B
Zig
23 lines
350 B
Zig
const std = @import("std");
|
|
|
|
noinline fn outer() u32 {
|
|
var a: u32 = 42;
|
|
_ = &a;
|
|
return inner(.{
|
|
.unused = a,
|
|
.value = [1]u32{0},
|
|
});
|
|
}
|
|
|
|
noinline fn inner(args: anytype) u32 {
|
|
return args.value[0];
|
|
}
|
|
|
|
pub fn main() !void {
|
|
try std.testing.expect(outer() == 0);
|
|
}
|
|
|
|
// run
|
|
// backend=stage2,llvm
|
|
// target=native
|