aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-01-12 15:04:43 +0100
committerAndrew Kelley <andrew@ziglang.org>2020-01-12 12:49:12 -0500
commitc96131f30caaf6d7cd1d202891a28ee0df8b577e (patch)
treedb1f02cdbc1955ef07b523c4c7ba0acb69476127 /src/ir.cpp
parentc4770e7aa54a7a88eacf9e7780b0fe860f29251f (diff)
downloadzig-c96131f30caaf6d7cd1d202891a28ee0df8b577e.tar.gz
zig-c96131f30caaf6d7cd1d202891a28ee0df8b577e.zip
Propagate errors in for loop bodies
Closes #3819
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 9f45ff5b2f..340b27119a 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7456,6 +7456,8 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
// it's actually in break statements, handled similarly to return statements.
// That is why we set those values in loop_scope above and not in this ir_gen_node call.
IrInstruction *body_result = ir_gen_node(irb, body_node, &loop_scope->base);
+ if (body_result == irb->codegen->invalid_instruction)
+ return irb->codegen->invalid_instruction;
if (!instr_is_unreachable(body_result)) {
ir_mark_gen(ir_build_check_statement_is_void(irb, child_scope, node->data.for_expr.body, body_result));