mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
parent
407d91f7a7
commit
d28f24d1d1
@ -189,3 +189,15 @@ test "errdefer used in function that doesn't return an error" {
|
||||
};
|
||||
try expect(S.foo() == 5);
|
||||
}
|
||||
|
||||
// Originally reported at https://github.com/ziglang/zig/issues/10591
|
||||
const defer_assign = switch (block: {
|
||||
var x = 0;
|
||||
defer x = 1;
|
||||
break :block x;
|
||||
}) {
|
||||
else => |i| i,
|
||||
};
|
||||
comptime {
|
||||
if (defer_assign != 0) @compileError("defer_assign failed!");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user