mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
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.
This commit is contained in:
parent
3a3704be05
commit
3aa533519d
@ -8818,9 +8818,12 @@ fn analyzeRef(
|
||||
|
||||
try sema.requireRuntimeBlock(block, src);
|
||||
const ptr_type = try Module.simplePtrType(sema.arena, operand_ty, false, .One);
|
||||
const alloc = try block.addTy(.alloc, ptr_type);
|
||||
const mut_ptr_type = try Module.simplePtrType(sema.arena, operand_ty, true, .One);
|
||||
const alloc = try block.addTy(.alloc, mut_ptr_type);
|
||||
try sema.storePtr(block, src, alloc, operand);
|
||||
return alloc;
|
||||
|
||||
// TODO: Replace with sema.coerce when that supports adding pointer constness.
|
||||
return sema.bitcast(block, ptr_type, alloc, src);
|
||||
}
|
||||
|
||||
fn analyzeLoad(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user