From 7972bc8aa8edb7bd213bd5ccdc90d70fb730efd2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 12 Apr 2022 12:20:08 -0700 Subject: [PATCH] Sema: fix struct init ref --- src/Sema.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Sema.zig b/src/Sema.zig index 77e11d4c0c..8142132679 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -12694,7 +12694,12 @@ fn finishStructInit( } if (is_ref) { - const alloc = try block.addTy(.alloc, struct_ty); + const target = sema.mod.getTarget(); + const alloc_ty = try Type.ptr(sema.arena, target, .{ + .pointee_type = struct_ty, + .@"addrspace" = target_util.defaultAddressSpace(target, .local), + }); + const alloc = try block.addTy(.alloc, alloc_ty); for (field_inits) |field_init, i_usize| { const i = @intCast(u32, i_usize); const field_src = src;