Commit e77fcf1730

Robin Voetter <robin@voetter.nl>
2021-08-27 02:48:29
Address Spaces: Implement right address space for slicing
1 parent 8672f26
Changed files (1)
src/Sema.zig
@@ -9767,9 +9767,7 @@ fn analyzeSlice(
         return_elem_type,
         if (end_opt == .none) slice_sentinel else null,
         0, // TODO alignment
-        // TODO(Snektron) address space, should be inferred from the pointer type.
-        // TODO(Snektron) address space for slicing a local, should compute address space from context and architecture.
-        .generic,
+        if (ptr_child.zigTypeTag() == .Pointer) ptr_child.ptrAddressSpace() else .generic,
         0,
         0,
         !ptr_child.isConstPtr(),