diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-05-26 14:39:18 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-05-26 14:39:18 -0400 |
| commit | c42c91ee7c630d47e6adc0a940b5f10bbe04d13a (patch) | |
| tree | e953816629530d2d532c097cbac3bb846e51763f /src/ir.cpp | |
| parent | fcdd808c5c1b866c2582a17839a53ce7bbbb78d6 (diff) | |
| download | zig-c42c91ee7c630d47e6adc0a940b5f10bbe04d13a.tar.gz zig-c42c91ee7c630d47e6adc0a940b5f10bbe04d13a.zip | |
fix segfault with array of generic functions
closes #377
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index b444281918..7a3f8cffce 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13089,12 +13089,20 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc } } IrInstruction *param_type_value = instruction->param_types[fn_type_id.next_param_index]->other; + if (type_is_invalid(param_type_value->value.type)) + return ira->codegen->builtin_types.entry_invalid; FnTypeParamInfo *param_info = &fn_type_id.param_info[fn_type_id.next_param_index]; param_info->is_noalias = param_node->data.param_decl.is_noalias; param_info->type = ir_resolve_type(ira, param_type_value); if (type_is_invalid(param_info->type)) return ira->codegen->builtin_types.entry_invalid; + + if (param_info->type->id == TypeTableEntryIdVar) { + ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); + out_val->data.x_type = get_generic_fn_type(ira->codegen, &fn_type_id); + return ira->codegen->builtin_types.entry_type; + } } IrInstruction *return_type_value = instruction->return_type->other; |
