add compile error for async call of function pointer

This commit is contained in:
Andrew Kelley
2019-08-03 01:06:14 -04:00
parent 0920bb0872
commit 24d78177ee
4 changed files with 21 additions and 6 deletions

View File

@@ -2,6 +2,18 @@ const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
"runtime-known function called with async keyword",
\\export fn entry() void {
\\ var ptr = afunc;
\\ _ = async ptr();
\\}
\\
\\async fn afunc() void { }
,
"tmp.zig:3:15: error: function is not comptime-known; @asyncCall required",
);
cases.add(
"function with ccc indirectly calling async function",
\\export fn entry() void {