aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-22 21:07:55 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-22 21:07:55 +0300
commit03b1fbe50d302cdb961661c10bb51699b4dcbaf2 (patch)
tree9419580acba06a94ccae2019bbe0631b39f54624 /src/codegen/llvm.zig
parent1f748fe42662da3ee2c977ba638a714e15acb433 (diff)
downloadzig-03b1fbe50d302cdb961661c10bb51699b4dcbaf2.tar.gz
zig-03b1fbe50d302cdb961661c10bb51699b4dcbaf2.zip
stage2: fix airIsErr when `is_ptr == true`
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 9dc20755eb..af610c8601 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5693,7 +5693,8 @@ pub const FuncGen = struct {
const un_op = self.air.instructions.items(.data)[inst].un_op;
const operand = try self.resolveInst(un_op);
- const err_union_ty = self.air.typeOf(un_op);
+ const operand_ty = self.air.typeOf(un_op);
+ const err_union_ty = if (operand_is_ptr) operand_ty.childType() else operand_ty;
const payload_ty = err_union_ty.errorUnionPayload();
const err_set_ty = try self.dg.lowerType(Type.initTag(.anyerror));
const zero = err_set_ty.constNull();