commit bc3094b278ebdce5f7f86224081a228495bc0dd6 (tree)
parent 6cf01a679f1950f1393d9245048a62500e3869c1
Author: David Rubin <daviru007@icloud.com>
Date: Wed, 27 Nov 2024 20:39:23 -0800
sema: make `++` and `**` return immutable pointers
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/Sema.zig b/src/Sema.zig
@@ -15226,7 +15226,10 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
if (ptr_addrspace) |ptr_as| {
const alloc_ty = try pt.ptrTypeSema(.{
.child = result_ty.toIntern(),
- .flags = .{ .address_space = ptr_as },
+ .flags = .{
+ .address_space = ptr_as,
+ .is_const = true,
+ },
});
const alloc = try block.addTy(.alloc, alloc_ty);
const elem_ptr_ty = try pt.ptrTypeSema(.{
@@ -15558,7 +15561,10 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
if (ptr_addrspace) |ptr_as| {
const alloc_ty = try pt.ptrTypeSema(.{
.child = result_ty.toIntern(),
- .flags = .{ .address_space = ptr_as },
+ .flags = .{
+ .address_space = ptr_as,
+ .is_const = true,
+ },
});
const alloc = try block.addTy(.alloc, alloc_ty);
const elem_ptr_ty = try pt.ptrTypeSema(.{