authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2021-10-26 02:28:02+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2021-10-26 02:28:02+02:00
log914993123c91534e4fa1d32c93bc43341cb24a8c
treea22b86f02a19d8a2d388a23126b59ce5d4df7307
parentdf198ea60e05664b5b72a43aae815fa06d94c19c

stage2: return proper pointer for c pointer orelse


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

src/Sema.zig+10-1
...@@ -4666,7 +4666,16 @@ fn zirOptionalPayload(...@@ -4666,7 +4666,16 @@ fn zirOptionalPayload(
4666 if (operand_ty.ptrSize() != .C) {4666 if (operand_ty.ptrSize() != .C) {
4667 return sema.failWithExpectedOptionalType(block, src, operand_ty);4667 return sema.failWithExpectedOptionalType(block, src, operand_ty);
4668 }4668 }
4669 break :t operand_ty;4669 const ptr_info = operand_ty.ptrInfo().data;
4670 break :t try Type.ptr(sema.arena, .{
4671 .pointee_type = try ptr_info.pointee_type.copy(sema.arena),
4672 .@"align" = ptr_info.@"align",
4673 .@"addrspace" = ptr_info.@"addrspace",
4674 .mutable = ptr_info.mutable,
4675 .@"allowzero" = ptr_info.@"allowzero",
4676 .@"volatile" = ptr_info.@"volatile",
4677 .size = .One,
4678 });
4670 },4679 },
4671 else => return sema.failWithExpectedOptionalType(block, src, operand_ty),4680 else => return sema.failWithExpectedOptionalType(block, src, operand_ty),
4672 };4681 };