| author | |
| committer | |
| log | d28f24d1d139c33ddfc2e8b763d9d18c933ef6d6 |
| tree | 47815e53367a87dcc295b99747ebe360da3a9a0e |
| parent | 407d91f7a7c28192857b3a85055aebdffd207bf1 |
closes #105911 files changed, 12 insertions(+), 0 deletions(-)
test/behavior/defer.zig+12| ... | ... | @@ -189,3 +189,15 @@ test "errdefer used in function that doesn't return an error" { |
| 189 | 189 | }; |
| 190 | 190 | try expect(S.foo() == 5); |
| 191 | 191 | } |
| 192 | ||
| 193 | // Originally reported at https://github.com/ziglang/zig/issues/10591 | |
| 194 | const defer_assign = switch (block: { | |
| 195 | var x = 0; | |
| 196 | defer x = 1; | |
| 197 | break :block x; | |
| 198 | }) { | |
| 199 | else => |i| i, | |
| 200 | }; | |
| 201 | comptime { | |
| 202 | if (defer_assign != 0) @compileError("defer_assign failed!"); | |
| 203 | } |