From e182c17187c12cfb448cf47a04a156caaf9e3fc9 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Thu, 26 Aug 2021 03:31:03 +0200 Subject: [PATCH] Address Spaces: Disallow coercing pointers to different address spaces --- src/Sema.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Sema.zig b/src/Sema.zig index a782cb2472..e0a085a010 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -9132,6 +9132,7 @@ fn coerce( const dest_is_mut = !dest_type.isConstPtr(); if (inst_ty.isConstPtr() and dest_is_mut) break :src_array_ptr; if (inst_ty.isVolatilePtr() and !dest_type.isVolatilePtr()) break :src_array_ptr; + if (inst_ty.ptrAddressSpace() != dest_type.ptrAddressSpace()) break :src_array_ptr; const dst_elem_type = dest_type.elemType(); switch (coerceInMemoryAllowed(dst_elem_type, array_elem_type, dest_is_mut)) {