llvm: fix lowering of packed structs with optional pointers
Closes #20022
This commit is contained in:
@@ -3775,6 +3775,7 @@ pub const Object = struct {
|
||||
.float,
|
||||
.enum_tag,
|
||||
=> {},
|
||||
.opt => {}, // pointer like optional expected
|
||||
else => unreachable,
|
||||
}
|
||||
const bits = ty.bitSize(mod);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user