authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2021-08-25 02:58:19+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-27 18:53:03-04:00
log3aa533519da073695a56a56159b7ea3c487fb1b2
tree254305dadbd443aca65aa4e38ce9e187cad2b2ed
parent3a3704be05adcf929353e836222399885d1d99fb

Store to mutable pointer in analyzeRef

This function previously attempted to store a value to an immutable pointer, after which storePtr would yield an error.

1 files changed, 5 insertions(+), 2 deletions(-)

src/Sema.zig+5-2
......@@ -8818,9 +8818,12 @@ fn analyzeRef(
88188818
88198819 try sema.requireRuntimeBlock(block, src);
88208820 const ptr_type = try Module.simplePtrType(sema.arena, operand_ty, false, .One);
8821 const alloc = try block.addTy(.alloc, ptr_type);
8821 const mut_ptr_type = try Module.simplePtrType(sema.arena, operand_ty, true, .One);
8822 const alloc = try block.addTy(.alloc, mut_ptr_type);
88228823 try sema.storePtr(block, src, alloc, operand);
8823 return alloc;
8824
8825 // TODO: Replace with sema.coerce when that supports adding pointer constness.
8826 return sema.bitcast(block, ptr_type, alloc, src);
88248827}
88258828
88268829fn analyzeLoad(