authorgravatar for liljaanton2001@gmail.comantlilja <liljaanton2001@gmail.com> 2024-03-17 12:25:09+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-03-17 13:25:09+02:00
log294f51814f491ae4a09348d9e7221ae3e550c16f
tree7a2f37e63ed6844dff71ef73ae8c2a24930c8f0c
parentf88a971e4ff211b78695609b4482fb886f30a1af
signaturebadge-check Signed by PGP key B5690EEEBB952194

LLVM lowerDebugType: Lower union types without a layout into an empty namespace


2 files changed, 19 insertions(+), 1 deletions(-)

src/codegen/llvm.zig+4-1
......@@ -2598,7 +2598,10 @@ pub const Object = struct {
25982598 defer gpa.free(name);
25992599
26002600 const union_type = ip.loadUnionType(ty.toIntern());
2601 if (!union_type.haveFieldTypes(ip) or !ty.hasRuntimeBitsIgnoreComptime(mod)) {
2601 if (!union_type.haveFieldTypes(ip) or
2602 !ty.hasRuntimeBitsIgnoreComptime(mod) or
2603 !union_type.haveLayout(ip))
2604 {
26022605 const debug_union_type = try o.makeEmptyNamespaceDebugType(owner_decl_index);
26032606 try o.debug_type_map.put(gpa, ty, debug_union_type);
26042607 return debug_union_type;
test/cases/union_unresolved_layout.zig created+15
......@@ -0,0 +1,15 @@
1const std = @import("std");
2
3const U = union(enum) {
4 foo: u8,
5 bar: f64,
6};
7
8pub fn main() !void {
9 const t = U.foo;
10 _ = t;
11}
12
13// run
14// backend=llvm
15//