| ... | @@ -1663,11 +1663,15 @@ fn resolveMaybeUndefValIntable( | ... | @@ -1663,11 +1663,15 @@ fn resolveMaybeUndefValIntable( |
| 1663 | inst: Air.Inst.Ref, | 1663 | inst: Air.Inst.Ref, |
| 1664 | ) CompileError!?Value { | 1664 | ) CompileError!?Value { |
| 1665 | const val = (try sema.resolveMaybeUndefValAllowVariables(block, src, inst)) orelse return null; | 1665 | const val = (try sema.resolveMaybeUndefValAllowVariables(block, src, inst)) orelse return null; |
| 1666 | switch (val.tag()) { | 1666 | var check = val; |
| 1667 | .variable, .decl_ref, .decl_ref_mut => return null, | 1667 | while (true) switch (check.tag()) { |
| | 1668 | .variable, .decl_ref, .decl_ref_mut, .comptime_field_ptr => return null, |
| | 1669 | .field_ptr => check = check.castTag(.field_ptr).?.data.container_ptr, |
| | 1670 | .elem_ptr => check = check.castTag(.elem_ptr).?.data.array_ptr, |
| | 1671 | .eu_payload_ptr, .opt_payload_ptr => check = check.cast(Value.Payload.PayloadPtr).?.data.container_ptr, |
| 1668 | .generic_poison => return error.GenericPoison, | 1672 | .generic_poison => return error.GenericPoison, |
| 1669 | else => return val, | 1673 | else => return val, |
| 1670 | } | 1674 | }; |
| 1671 | } | 1675 | } |
| 1672 | | 1676 | |
| 1673 | /// Returns all Value tags including `variable` and `undef`. | 1677 | /// Returns all Value tags including `variable` and `undef`. |
| ... | @@ -7893,7 +7897,7 @@ fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -7893,7 +7897,7 @@ fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 7893 | if (!ptr_ty.isPtrAtRuntime()) { | 7897 | if (!ptr_ty.isPtrAtRuntime()) { |
| 7894 | return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(sema.mod)}); | 7898 | return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(sema.mod)}); |
| 7895 | } | 7899 | } |
| 7896 | if (try sema.resolveMaybeUndefVal(block, ptr_src, ptr)) |ptr_val| { | 7900 | if (try sema.resolveMaybeUndefValIntable(block, ptr_src, ptr)) |ptr_val| { |
| 7897 | return sema.addConstant(Type.usize, ptr_val); | 7901 | return sema.addConstant(Type.usize, ptr_val); |
| 7898 | } | 7902 | } |
| 7899 | try sema.requireRuntimeBlock(block, ptr_src, ptr_src); | 7903 | try sema.requireRuntimeBlock(block, ptr_src, ptr_src); |