diff options
| author | xackus <14938807+xackus@users.noreply.github.com> | 2020-03-05 08:32:09 +0100 |
|---|---|---|
| committer | xackus <14938807+xackus@users.noreply.github.com> | 2020-03-08 18:05:45 +0100 |
| commit | 7782c76bee0201227be730ae131171939f728538 (patch) | |
| tree | 9667fa7cc1ae51a61dd9fb4a5ad45579550b56e4 /src/ir.cpp | |
| parent | f90fe1f8f2be6ffa1c19997d123e12310d9e04b5 (diff) | |
| download | zig-7782c76bee0201227be730ae131171939f728538.tar.gz zig-7782c76bee0201227be730ae131171939f728538.zip | |
fix failed assert on generic fn opaque return type
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 34f3ef26a7..67eabf5040 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -19339,6 +19339,19 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, ZigType *specified_return_type = ir_analyze_type_expr(ira, impl_fn->child_scope, return_type_node); if (type_is_invalid(specified_return_type)) return ira->codegen->invalid_inst_gen; + + if(!is_valid_return_type(specified_return_type)){ + ErrorMsg *msg = ir_add_error(ira, source_instr, + buf_sprintf("call to generic function with return type '%s' not allowed", buf_ptr(&specified_return_type->name))); + add_error_note(ira->codegen, msg, fn_proto_node, buf_sprintf("function declared here")); + + Tld *tld = find_decl(ira->codegen, &fn_entry->fndef_scope->base, &specified_return_type->name); + if (tld != nullptr) { + add_error_note(ira->codegen, msg, tld->source_node, buf_sprintf("type declared here")); + } + return ira->codegen->invalid_inst_gen; + } + if (fn_proto_node->data.fn_proto.auto_err_set) { ZigType *inferred_err_set_type = get_auto_err_set_type(ira->codegen, impl_fn); if ((err = type_resolve(ira->codegen, specified_return_type, ResolveStatusSizeKnown))) |
