aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-09-03 18:15:01 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-09-03 18:15:01 -0400
commita81e4351a20f836d88f455843d875e45a1c73b71 (patch)
tree462e53bd4cc63c091b324d015b1dabc95d3c802e /src
parentfc0f8d0359777580c771848361166f97a85deddd (diff)
parent1b19c28c79ac20c4b8880742172834f881b47dea (diff)
downloadzig-a81e4351a20f836d88f455843d875e45a1c73b71.tar.gz
zig-a81e4351a20f836d88f455843d875e45a1c73b71.zip
Merge branch 'fixSegfault' of https://github.com/marler8997/zig into marler8997-fixSegfault
Diffstat (limited to 'src')
-rw-r--r--src/analyze.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 9b361baa56..188da18515 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -7687,8 +7687,13 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
ZigType *tag_type = union_type->data.unionation.tag_type;
uint32_t gen_field_count = union_type->data.unionation.gen_field_count;
if (gen_field_count == 0) {
- union_type->llvm_type = get_llvm_type(g, tag_type);
- union_type->llvm_di_type = get_llvm_di_type(g, tag_type);
+ if (tag_type == nullptr) {
+ union_type->llvm_type = g->builtin_types.entry_void->llvm_type;
+ union_type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type;
+ } else {
+ union_type->llvm_type = get_llvm_type(g, tag_type);
+ union_type->llvm_di_type = get_llvm_di_type(g, tag_type);
+ }
union_type->data.unionation.resolve_status = ResolveStatusLLVMFull;
return;
}