From ef7eff393912cae322fbc755536bc060c0166b94 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 25 Jan 2022 14:53:41 -0700 Subject: Sema: coercion of pointers to C pointers --- src/Sema.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/Sema.zig b/src/Sema.zig index a761623b2e..6fc4f85174 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -14014,6 +14014,23 @@ fn coerce( const addr = try sema.coerce(block, ptr_size_ty, inst, inst_src); return sema.coerceCompatiblePtrs(block, dest_ty, addr, inst_src); }, + .Pointer => p: { + const inst_info = inst_ty.ptrInfo().data; + if (inst_info.size == .Slice) break :p; + switch (try sema.coerceInMemoryAllowed( + block, + dest_info.pointee_type, + inst_info.pointee_type, + dest_info.mutable, + target, + dest_ty_src, + inst_src, + )) { + .ok => {}, + .no_match => break :p, + } + return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); + }, else => {}, } } -- cgit v1.2.3