diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-03 01:06:14 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-03 01:06:14 -0400 |
| commit | 24d78177eec4d8fc3aa8ca99dd50788e38f9f8b6 (patch) | |
| tree | 14f0b5e36cb4ec2bc68717c6368afeb06a1b857e /src | |
| parent | 0920bb087279bdfa317fc88cef877d40ece18239 (diff) | |
| download | zig-24d78177eec4d8fc3aa8ca99dd50788e38f9f8b6.tar.gz zig-24d78177eec4d8fc3aa8ca99dd50788e38f9f8b6.zip | |
add compile error for async call of function pointer
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f140cfeabe..b01f43b3e1 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -14819,7 +14819,10 @@ static IrInstruction *ir_analyze_instruction_reset_result(IrAnalyze *ira, IrInst static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc *call_instruction, ZigFn *fn_entry, ZigType *fn_type, IrInstruction *fn_ref, IrInstruction **casted_args, size_t arg_count) { - ir_assert(fn_entry != nullptr, &call_instruction->base); + if (fn_entry == nullptr) { + ir_add_error(ira, fn_ref, buf_sprintf("function is not comptime-known; @asyncCall required")); + return ira->codegen->invalid_instruction; + } ZigType *frame_type = get_coro_frame_type(ira->codegen, fn_entry); IrInstruction *result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, |
