aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-28 17:42:29 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-28 17:42:29 -0700
commitd0a1901cb06bf9efaa4c78f9a990663aeb63ce85 (patch)
treef3bc07ef54b3ccb89932eb6d3ff1ccf692cd775c /test/run_tests.cpp
parent974d69ea3d0db71b97af00e325fdfb421c0906c2 (diff)
downloadzig-d0a1901cb06bf9efaa4c78f9a990663aeb63ce85.tar.gz
zig-d0a1901cb06bf9efaa4c78f9a990663aeb63ce85.zip
fix function calling of pointers
See #14
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp23
1 files changed, 23 insertions, 0 deletions
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");
}
//////////////////////////////////////////////////////////////////////////////