mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 15:12:31 +00:00
LLVM lowerDebugType: Lower union types without a layout into an empty namespace
This commit is contained in:
parent
f88a971e4f
commit
294f51814f
@ -2598,7 +2598,10 @@ pub const Object = struct {
|
||||
defer gpa.free(name);
|
||||
|
||||
const union_type = ip.loadUnionType(ty.toIntern());
|
||||
if (!union_type.haveFieldTypes(ip) or !ty.hasRuntimeBitsIgnoreComptime(mod)) {
|
||||
if (!union_type.haveFieldTypes(ip) or
|
||||
!ty.hasRuntimeBitsIgnoreComptime(mod) or
|
||||
!union_type.haveLayout(ip))
|
||||
{
|
||||
const debug_union_type = try o.makeEmptyNamespaceDebugType(owner_decl_index);
|
||||
try o.debug_type_map.put(gpa, ty, debug_union_type);
|
||||
return debug_union_type;
|
||||
|
15
test/cases/union_unresolved_layout.zig
Normal file
15
test/cases/union_unresolved_layout.zig
Normal file
@ -0,0 +1,15 @@
|
||||
const std = @import("std");
|
||||
|
||||
const U = union(enum) {
|
||||
foo: u8,
|
||||
bar: f64,
|
||||
};
|
||||
|
||||
pub fn main() !void {
|
||||
const t = U.foo;
|
||||
_ = t;
|
||||
}
|
||||
|
||||
// run
|
||||
// backend=llvm
|
||||
//
|
Loading…
Reference in New Issue
Block a user