12 void f(A
*) { feedback
= 1; }
13 void f(B
*) { feedback
= 2; }
16 } // anonymous namespace
18 bool test_implicit_cast()
20 using namespace luabind
;
22 lua_State
* L
= lua_open();
24 int top
= lua_gettop(L
);
29 .def(constructor
<>());
32 .def(constructor
<>());
34 typedef void (test_implicit::*f1
)(A
*);
35 typedef void (test_implicit::*f2
)(B
*);
37 class_
<test_implicit
>(L
, "test")
39 .def("f", (f1
) &test_implicit::f
)
40 .def("f", (f2
) &test_implicit::f
);
42 if (dostring(L
, "a = A()")) return false;
43 if (dostring(L
, "b = B()")) return false;
44 if (dostring(L
, "t = test()")) return false;
46 if (dostring(L
, "t:f(a)")) return false;
47 if (feedback
!= 1) return false;
49 if (dostring(L
, "t:f(b)")) return false;
50 if (feedback
!= 2) return false;
52 if (top
!= lua_gettop(L
)) return false;