From 2e562a5f366aabefd34a4191b2cd0b5e72d3d089 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 25 Sep 2018 12:03:39 -0400 Subject: fix crash on runtime index into slice of comptime type closes #1435 --- src/analyze.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/analyze.cpp') 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)) -- cgit v1.2.3