aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-25 12:03:39 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-25 12:03:39 -0400
commit2e562a5f366aabefd34a4191b2cd0b5e72d3d089 (patch)
tree96192ee77cac902e9954d534a5009c4c04e28855 /src/analyze.cpp
parent839492d0e82e5d7b2a5cee54acb9e64b414e9817 (diff)
downloadzig-2e562a5f366aabefd34a4191b2cd0b5e72d3d089.tar.gz
zig-2e562a5f366aabefd34a4191b2cd0b5e72d3d089.zip
fix crash on runtime index into slice of comptime type
closes #1435
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index ca80958887..650f5b6b11 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -1187,8 +1187,11 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
if ((err = type_resolve(g, type_entry, ResolveStatusZeroBitsKnown)))
return g->builtin_types.entry_invalid;
- if (is_c_abi)
+ if (is_c_abi) {
+ if ((err = type_resolve(g, type_entry, ResolveStatusSizeKnown)))
+ return g->builtin_types.entry_invalid;
continue;
+ }
if (type_has_bits(type_entry)) {
ZigType *gen_type;
@@ -4464,7 +4467,7 @@ bool handle_is_ptr(ZigType *type_entry) {
return type_has_bits(type_entry->data.maybe.child_type) &&
!type_is_codegen_pointer(type_entry->data.maybe.child_type);
case ZigTypeIdUnion:
- assert(type_entry->data.unionation.complete);
+ assert(type_entry->data.unionation.zero_bits_known);
if (type_entry->data.unionation.gen_field_count == 0)
return false;
if (!type_has_bits(type_entry))