Commit 272fe0cbfe

Timon Kruiper <timonkruiper@gmail.com>
2021-04-08 14:20:40
stage2: fix bug in ZIR gen of global comptime block
A global comptime block did not end with a break_inline instruction which caused an assertion to be hit.
1 parent ab5a445
Changed files (1)
src/Module.zig
@@ -2513,6 +2513,7 @@ fn astgenAndSemaDecl(mod: *Module, decl: *Decl) !bool {
 
                 const block_expr = node_datas[decl_node].lhs;
                 _ = try AstGen.comptimeExpr(&gen_scope, &gen_scope.base, .none, block_expr);
+                _ = try gen_scope.addBreak(.break_inline, gen_scope.break_block, .void_value);
 
                 const code = try gen_scope.finish();
                 if (std.builtin.mode == .Debug and mod.comp.verbose_ir) {