From 64a1a280ef2b5858aa9d5ec659badf3e5236b5f9 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 28 Jul 2020 22:08:56 -0700 Subject: [PATCH] stage2: fix superfluous returnvoid ZIR --- src-self-hosted/astgen.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-self-hosted/astgen.zig b/src-self-hosted/astgen.zig index 6f369e7879..3f08d1272d 100644 --- a/src-self-hosted/astgen.zig +++ b/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); + } }, } }