| author | |
| committer | |
| log | 1c4c68e6ba058f0c320f222275335245305974a0 |
| tree | df38ca766ddfb85723b9cab92be6f3f16531a58b |
| parent | db54cd247ddb8bf7b4225eaaf1e7a851151f8f0b |
Closes #122482 files changed, 12 insertions(+), 1 deletions(-)
src/AstGen.zig+1-1| ... | ... | @@ -5127,7 +5127,7 @@ fn tryExpr( |
| 5127 | 5127 | else => .none, |
| 5128 | 5128 | }; |
| 5129 | 5129 | // This could be a pointer or value depending on the `rl` parameter. |
| 5130 | const operand = try expr(parent_gz, scope, operand_rl, operand_node); | |
| 5130 | const operand = try reachableExpr(parent_gz, scope, operand_rl, operand_node, node); | |
| 5131 | 5131 | const is_inline = parent_gz.force_comptime; |
| 5132 | 5132 | const is_inline_bit = @as(u2, @boolToInt(is_inline)); |
| 5133 | 5133 | const is_ptr_bit = @as(u2, @boolToInt(operand_rl == .ref)) << 1; |
test/cases/compile_errors/try_return.zig created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | pub fn foo() !void { | |
| 2 | try return bar(); | |
| 3 | } | |
| 4 | pub fn bar() !void {} | |
| 5 | ||
| 6 | // error | |
| 7 | // backend=stage2 | |
| 8 | // target=native | |
| 9 | // | |
| 10 | // :2:5: error: unreachable code | |
| 11 | // :2:9: note: control flow is diverted here |