5 LUABIND_ANONYMOUS_FIX
int feedback
= 0;
7 struct A
{ virtual ~A() {} };
12 void f(A
*) { feedback
= 1; }
13 void f(B
*) { feedback
= 2; }
16 } // anonymous namespace
18 #include <luabind/pointer_holder.hpp>
20 void test_instance_holder(lua_State* L)
22 using namespace luabind;
24 // pointer_holder<A, A*> holder(new B);
26 // void* p = holder.holds(LUABIND_TYPEID(B));
29 bool test_implicit_cast()
31 using namespace luabind
;
33 lua_State
* L
= lua_open();
35 int top
= lua_gettop(L
);
39 typedef void (test_implicit::*f1
)(A
*);
40 typedef void (test_implicit::*f2
)(B
*);
45 .def(constructor
<>()),
48 .def(constructor
<>()),
50 class_
<test_implicit
>("test")
52 .def("f", (f1
) &test_implicit::f
)
53 .def("f", (f2
) &test_implicit::f
)
56 // test_instance_holder(L);
58 if (dostring(L
, "a = A()")) return false;
59 if (dostring(L
, "b = B()")) return false;
60 if (dostring(L
, "t = test()")) return false;
62 if (dostring(L
, "t:f(a)")) return false;
63 if (feedback
!= 1) return false;
65 if (dostring(L
, "t:f(b)")) return false;
66 if (feedback
!= 2) return false;
68 if (top
!= lua_gettop(L
)) return false;