implement @asyncCall which supports async function pointers

This commit is contained in:
Andrew Kelley
2019-08-03 16:14:24 -04:00
parent c879209661
commit 87710a1cc2
8 changed files with 247 additions and 61 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(
"non async function pointer passed to @asyncCall",
\\export fn entry() void {
\\ var ptr = afunc;
\\ var bytes: [100]u8 = undefined;
\\ _ = @asyncCall(&bytes, {}, ptr);
\\}
\\fn afunc() void { }
,
"tmp.zig:4:32: error: expected async function, found 'fn() void'",
);
cases.add(
"runtime-known async function called",
\\export fn entry() void {