fix function calling of pointers

See #14
This commit is contained in:
Andrew Kelley
2016-01-28 17:42:29 -07:00
parent 974d69ea3d
commit d0a1901cb0
2 changed files with 46 additions and 24 deletions

View File

@@ -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");
}
//////////////////////////////////////////////////////////////////////////////