aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-10 10:12:08 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-10 10:12:08 -0400
commit28f9230b40ee7aa179705c39616aaf2a5f303b73 (patch)
treec8fabad00b800c43143fe148557c23a64c129de0 /src/ir.cpp
parentb5cfbfd84ee26d5174abf3368b75b9e4502898a5 (diff)
downloadzig-28f9230b40ee7aa179705c39616aaf2a5f303b73.tar.gz
zig-28f9230b40ee7aa179705c39616aaf2a5f303b73.zip
fix crash when calling comptime-known undefined function ptr
closes #880 closes #1212
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 2dc6ddad2c..10ce3254fd 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -13271,6 +13271,8 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction
return ir_finish_anal(ira, cast_instruction->value.type);
} else if (fn_ref->value.type->id == TypeTableEntryIdFn) {
FnTableEntry *fn_table_entry = ir_resolve_fn(ira, fn_ref);
+ if (fn_table_entry == nullptr)
+ return ira->codegen->builtin_types.entry_invalid;
return ir_analyze_fn_call(ira, call_instruction, fn_table_entry, fn_table_entry->type_entry,
fn_ref, nullptr, is_comptime, call_instruction->fn_inline);
} else if (fn_ref->value.type->id == TypeTableEntryIdBoundFn) {