diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-08-21 02:07:40 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-08-21 11:31:22 -0700 |
| commit | 6a5463951f0aa11cbdd5575cc78e85cd2ed10b46 (patch) | |
| tree | 9cff18509ff5a08748755d5dd57cc015a1a304a1 /src/Sema.zig | |
| parent | 82c8e45a7e7659146b2ecda2929f01027b0658e4 (diff) | |
| download | zig-6a5463951f0aa11cbdd5575cc78e85cd2ed10b46.tar.gz zig-6a5463951f0aa11cbdd5575cc78e85cd2ed10b46.zip | |
Sema: disallow C pointer to slice coercion
Resolves: #16719
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index b4dd9fbd66..504a335b53 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -27289,6 +27289,7 @@ fn coerceExtra( // coercion from C pointer if (inst_ty.isCPtr(mod)) src_c_ptr: { + if (dest_info.flags.size == .Slice) break :src_c_ptr; if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :src_c_ptr; // In this case we must add a safety check because the C pointer // could be null. |
