From 24d78177eec4d8fc3aa8ca99dd50788e38f9f8b6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 3 Aug 2019 01:06:14 -0400 Subject: add compile error for async call of function pointer --- test/compile_errors.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/compile_errors.zig') diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 272d99c930..4b1a24c675 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -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 { -- cgit v1.2.3