aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-01-18 15:13:21 +0100
committerLemonBoy <thatlemon@gmail.com>2020-01-18 15:13:21 +0100
commitc53d94e5127a8dcfefd906c5be0e6b81eaf3d22c (patch)
treef3e94d0a5a2a8f8d7c7cf3d3611ff2a47c47612f /src/analyze.cpp
parentb72f858194a3f6391de06d83ffa49596cfce21a4 (diff)
downloadzig-c53d94e5127a8dcfefd906c5be0e6b81eaf3d22c.tar.gz
zig-c53d94e5127a8dcfefd906c5be0e6b81eaf3d22c.zip
Prevent crash with empty non-exhaustive enum
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index e064677a09..0bbec66a9b 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -8312,7 +8312,7 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatu
uint32_t field_count = enum_type->data.enumeration.src_field_count;
- assert(enum_type->data.enumeration.fields);
+ assert(field_count == 0 || enum_type->data.enumeration.fields != nullptr);
ZigLLVMDIEnumerator **di_enumerators = allocate<ZigLLVMDIEnumerator*>(field_count);
for (uint32_t i = 0; i < field_count; i += 1) {