Commit 64a1a280ef

Andrew Kelley <andrew@ziglang.org>
2020-07-29 07:08:56
stage2: fix superfluous returnvoid ZIR
1 parent 4beff80
Changed files (1)
src-self-hosted
src-self-hosted/astgen.zig
@@ -145,8 +145,10 @@ pub fn blockExpr(mod: *Module, parent_scope: *Scope, block_node: *ast.Node.Block
 
             else => {
                 const possibly_unused_result = try expr(mod, scope, .none, statement);
-                const src = scope.tree().token_locs[statement.firstToken()].start;
-                _ = try addZIRUnOp(mod, scope, src, .ensure_result_used, possibly_unused_result);
+                if (!possibly_unused_result.tag.isNoReturn()) {
+                    const src = scope.tree().token_locs[statement.firstToken()].start;
+                    _ = try addZIRUnOp(mod, scope, src, .ensure_result_used, possibly_unused_result);
+                }
             },
         }
     }