aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2021-08-26 03:31:03 +0200
committerRobin Voetter <robin@voetter.nl>2021-09-20 02:29:03 +0200
commite182c17187c12cfb448cf47a04a156caaf9e3fc9 (patch)
tree80f6924e220fa7da8c28b48dc07266e5048b3ac3 /src/Sema.zig
parent0e6dc64a6fa173ae92197f692cf907fdc8bbf811 (diff)
downloadzig-e182c17187c12cfb448cf47a04a156caaf9e3fc9.tar.gz
zig-e182c17187c12cfb448cf47a04a156caaf9e3fc9.zip
Address Spaces: Disallow coercing pointers to different address spaces
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig1
1 files changed, 1 insertions, 0 deletions
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)) {