authorgravatar for mitchell.hashimoto@gmail.comMitchell Hashimoto <mitchell.hashimoto@gmail.com> 2022-03-05 12:12:45-08:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-06 10:38:53+02:00
logbf972e44d5d0ce704cae99957d565c55ea16335d
treec709555e4de2eea52d52a6927b0bf0f3c3da6a14
parentcd43f323d28e66d11273425cc6debcce735c33e2

stage2: coerce [*:0]u8 to other valid pointer types

This makes the following work properly (as it does in stage1, too): var zero_ptr: [*:0]const u8 = undefined; var no_zero_ptr: [*]const u8 = zero_ptr; Prior to this this would fail with an "expected type" error since coercion failed.

1 files changed, 1 insertions(+), 0 deletions(-)

src/Sema.zig+1
...@@ -19939,6 +19939,7 @@ fn typePtrOrOptionalPtrTy(...@@ -19939,6 +19939,7 @@ fn typePtrOrOptionalPtrTy(
19939 .many_mut_pointer,19939 .many_mut_pointer,
19940 .manyptr_u8,19940 .manyptr_u8,
19941 .manyptr_const_u8,19941 .manyptr_const_u8,
19942 .manyptr_const_u8_sentinel_0,
19942 => return ty,19943 => return ty,
1994319944
19944 .pointer => switch (ty.ptrSize()) {19945 .pointer => switch (ty.ptrSize()) {