aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorJonathan Marler <johnnymarler@gmail.com>2019-08-24 01:54:44 -0600
committerJonathan Marler <johnnymarler@gmail.com>2019-08-24 10:47:27 -0600
commit1b19c28c79ac20c4b8880742172834f881b47dea (patch)
tree186b6855d65fc05816652b50859d4c609d825e2e /src/analyze.cpp
parentec2f9ef4e8be5995ab652dde59b12ee340a9e28d (diff)
downloadzig-1b19c28c79ac20c4b8880742172834f881b47dea.tar.gz
zig-1b19c28c79ac20c4b8880742172834f881b47dea.zip
Fix issue 3058: zig build segfault
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 35c598ab97..fa239808f5 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -7198,8 +7198,13 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
ZigType *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member;
ZigType *tag_type = union_type->data.unionation.tag_type;
if (most_aligned_union_member == nullptr) {
- 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;
}