diff options
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index eb5265d404..ab9d36f3c8 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -18280,6 +18280,17 @@ fn resolvePeerTypes( }, .Pointer => { if (candidate_ty.ptrSize() == .C) { + // *T to [*c]T + if (chosen_ty_tag == .Pointer) { + const chosen_elem_ty = chosen_ty.childType(); + const candidate_elem_ty = candidate_ty.childType(); + if ((try sema.coerceInMemoryAllowed(block, chosen_elem_ty, candidate_elem_ty, false, target, src, src)) == .ok) { + chosen = candidate; + chosen_i = candidate_i + 1; + continue; + } + } + if (chosen_ty_tag == .Int or chosen_ty_tag == .ComptimeInt) { chosen = candidate; chosen_i = candidate_i + 1; @@ -18290,6 +18301,15 @@ fn resolvePeerTypes( } } + // [*c]T and *T + if (chosen_ty_tag == .Pointer and chosen_ty.ptrSize() == .C) { + const chosen_elem_ty = chosen_ty.childType(); + const candidate_elem_ty = candidate_ty.childType(); + if ((try sema.coerceInMemoryAllowed(block, chosen_elem_ty, candidate_elem_ty, false, target, src, src)) == .ok) { + continue; + } + } + // *[N]T to [*]T if (candidate_ty.ptrSize() == .Many and chosen_ty_tag == .Pointer and |
