| ... | @@ -4279,7 +4279,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -4279,7 +4279,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4279 | const const_ptr_ty = try sema.makePtrTyConst(final_ptr_ty); | 4279 | const const_ptr_ty = try sema.makePtrTyConst(final_ptr_ty); |
| 4280 | const new_const_ptr = try mod.getCoerced(Value.fromInterned(ptr_val), const_ptr_ty); | 4280 | const new_const_ptr = try mod.getCoerced(Value.fromInterned(ptr_val), const_ptr_ty); |
| 4281 | | 4281 | |
| 4282 | // Remap the ZIR oeprand to the resolved pointer value | 4282 | // Remap the ZIR operand to the resolved pointer value |
| 4283 | sema.inst_map.putAssumeCapacity(inst_data.operand.toIndex().?, Air.internedToRef(new_const_ptr.toIntern())); | 4283 | sema.inst_map.putAssumeCapacity(inst_data.operand.toIndex().?, Air.internedToRef(new_const_ptr.toIntern())); |
| 4284 | | 4284 | |
| 4285 | // Unless the block is comptime, `alloc_inferred` always produces | 4285 | // Unless the block is comptime, `alloc_inferred` always produces |
| ... | @@ -4305,6 +4305,11 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -4305,6 +4305,11 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4305 | .data = .{ .ty = final_ptr_ty }, | 4305 | .data = .{ .ty = final_ptr_ty }, |
| 4306 | }); | 4306 | }); |
| 4307 | | 4307 | |
| | 4308 | if (ia1.is_const) { |
| | 4309 | // Remap the ZIR operand to the pointer const |
| | 4310 | sema.inst_map.putAssumeCapacity(inst_data.operand.toIndex().?, try sema.makePtrConst(block, ptr)); |
| | 4311 | } |
| | 4312 | |
| 4308 | // Now we need to go back over all the store instructions, and do the logic as if | 4313 | // Now we need to go back over all the store instructions, and do the logic as if |
| 4309 | // the new result ptr type was available. | 4314 | // the new result ptr type was available. |
| 4310 | | 4315 | |