mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 08:33:15 +00:00
commit
5fe9f88b13
@ -3775,6 +3775,7 @@ pub const Object = struct {
|
||||
.float,
|
||||
.enum_tag,
|
||||
=> {},
|
||||
.opt => {}, // pointer like optional expected
|
||||
else => unreachable,
|
||||
}
|
||||
const bits = ty.bitSize(mod);
|
||||
@ -4376,7 +4377,7 @@ pub const Object = struct {
|
||||
.int => try o.builder.castConst(
|
||||
.inttoptr,
|
||||
try o.builder.intConst(try o.lowerType(Type.usize), offset),
|
||||
.ptr,
|
||||
try o.lowerType(Type.fromInterned(ptr.ty)),
|
||||
),
|
||||
.eu_payload => |eu_ptr| try o.lowerPtr(
|
||||
eu_ptr,
|
||||
|
||||
@ -1304,3 +1304,10 @@ test "2-byte packed struct argument in C calling convention" {
|
||||
try S.bar(s);
|
||||
}
|
||||
}
|
||||
|
||||
test "packed struct contains optional pointer" {
|
||||
const foo: packed struct {
|
||||
a: ?*@This() = null,
|
||||
} = .{};
|
||||
try expect(foo.a == null);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user