aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AstGen.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 8d91edd7b2..7d567b223d 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -5570,7 +5570,11 @@ fn ifExpr(
};
} else .{
.src = if_full.ast.then_expr,
- .result = .none,
+ .result = switch (rl) {
+ // Explicitly store void to ptr result loc if there is no else branch
+ .ptr, .block_ptr => try rvalue(&else_scope, rl, .void_value, node),
+ else => .none,
+ },
};
const break_tag: Zir.Inst.Tag = if (parent_gz.force_comptime) .break_inline else .@"break";