mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
stage2: return proper pointer for c pointer orelse
This commit is contained in:
parent
df198ea60e
commit
914993123c
11
src/Sema.zig
11
src/Sema.zig
@ -4666,7 +4666,16 @@ fn zirOptionalPayload(
|
||||
if (operand_ty.ptrSize() != .C) {
|
||||
return sema.failWithExpectedOptionalType(block, src, operand_ty);
|
||||
}
|
||||
break :t operand_ty;
|
||||
const ptr_info = operand_ty.ptrInfo().data;
|
||||
break :t try Type.ptr(sema.arena, .{
|
||||
.pointee_type = try ptr_info.pointee_type.copy(sema.arena),
|
||||
.@"align" = ptr_info.@"align",
|
||||
.@"addrspace" = ptr_info.@"addrspace",
|
||||
.mutable = ptr_info.mutable,
|
||||
.@"allowzero" = ptr_info.@"allowzero",
|
||||
.@"volatile" = ptr_info.@"volatile",
|
||||
.size = .One,
|
||||
});
|
||||
},
|
||||
else => return sema.failWithExpectedOptionalType(block, src, operand_ty),
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user