| author | |
| committer | |
| log | 294f51814f491ae4a09348d9e7221ae3e550c16f |
| tree | 7a2f37e63ed6844dff71ef73ae8c2a24930c8f0c |
| parent | f88a971e4ff211b78695609b4482fb886f30a1af |
| signature | Signed by PGP key B5690EEEBB952194 |
2 files changed, 19 insertions(+), 1 deletions(-)
src/codegen/llvm.zig+4-1| ... | ... | @@ -2598,7 +2598,10 @@ pub const Object = struct { |
| 2598 | 2598 | defer gpa.free(name); |
| 2599 | 2599 | |
| 2600 | 2600 | 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 | { | |
| 2602 | 2605 | const debug_union_type = try o.makeEmptyNamespaceDebugType(owner_decl_index); |
| 2603 | 2606 | try o.debug_type_map.put(gpa, ty, debug_union_type); |
| 2604 | 2607 | return debug_union_type; |
test/cases/union_unresolved_layout.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | const U = union(enum) { | |
| 4 | foo: u8, | |
| 5 | bar: f64, | |
| 6 | }; | |
| 7 | ||
| 8 | pub fn main() !void { | |
| 9 | const t = U.foo; | |
| 10 | _ = t; | |
| 11 | } | |
| 12 | ||
| 13 | // run | |
| 14 | // backend=llvm | |
| 15 | // |