From d0a1901cb06bf9efaa4c78f9a990663aeb63ce85 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 28 Jan 2016 17:42:29 -0700 Subject: fix function calling of pointers See #14 --- test/run_tests.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/run_tests.cpp') diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 84704d5f64..9959eba605 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1823,6 +1823,29 @@ const x : u8 = 300; const x = 2 == 2.0; )SOURCE", 1, ".tmp_source.zig:2:11: error: integer value 2 cannot be implicitly casted to type '(float literal)'"); + add_compile_fail_case("missing function call param", R"SOURCE( +struct Foo { + a: i32, + b: i32, + + fn member_a(foo: Foo) -> i32 { + return foo.a; + } + fn member_b(foo: Foo) -> i32 { + return foo.b; + } +} + +const member_fn_type = @typeof(Foo.member_a); +const members = []member_fn_type { + Foo.member_a, + Foo.member_b, +}; + +fn f(foo: Foo, index: i32) { + const result = members[index](); +} + )SOURCE", 1, ".tmp_source.zig:21:34: error: expected 1 arguments, got 0"); } ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3