llvm: fix lowering of packed structs with optional pointers

Closes #20022
This commit is contained in:
Veikka Tuominen
2024-05-21 19:51:08 +03:00
parent 167854c19c
commit f776e70c39
2 changed files with 8 additions and 0 deletions

View File

@@ -3775,6 +3775,7 @@ pub const Object = struct {
.float,
.enum_tag,
=> {},
.opt => {}, // pointer like optional expected
else => unreachable,
}
const bits = ty.bitSize(mod);

View File

@@ -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);
}