diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-22 21:07:55 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-22 21:07:55 +0300 |
| commit | 03b1fbe50d302cdb961661c10bb51699b4dcbaf2 (patch) | |
| tree | 9419580acba06a94ccae2019bbe0631b39f54624 /src/codegen/c.zig | |
| parent | 1f748fe42662da3ee2c977ba638a714e15acb433 (diff) | |
| download | zig-03b1fbe50d302cdb961661c10bb51699b4dcbaf2.tar.gz zig-03b1fbe50d302cdb961661c10bb51699b4dcbaf2.zip | |
stage2: fix airIsErr when `is_ptr == true`
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 15eb917fda..1e629d7cb0 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -3618,8 +3618,9 @@ fn airIsErr( const operand = try f.resolveInst(un_op); const operand_ty = f.air.typeOf(un_op); const local = try f.allocLocal(Type.initTag(.bool), .Const); - const payload_ty = operand_ty.errorUnionPayload(); - const error_ty = operand_ty.errorUnionSet(); + const err_union_ty = if (is_ptr) operand_ty.childType() else operand_ty; + const payload_ty = err_union_ty.errorUnionPayload(); + const error_ty = err_union_ty.errorUnionSet(); try writer.writeAll(" = "); |
