10 A(int a
) { feedback
= a
; }
11 A(const A
&) { feedback
= 21; }
12 A() { feedback
= 20; }
13 ~A() { feedback
= -1; }
17 void f(A
*, const A
&) {}
21 B(int a
):A(a
) { feedback2
= a
; }
22 B() { feedback2
= 20; }
23 ~B() { feedback2
= -1; }
26 } // anonymous namespace
28 bool test_construction()
30 using namespace luabind
;
32 lua_State
* L
= lua_open();
34 int top
= lua_gettop(L
);
40 .def(constructor
<int>())
41 .def(constructor
<const A
&>())
42 .def(constructor
<>());
45 .def(constructor
<int>())
46 .def(constructor
<>());
48 if (dostring(L
, "a = A(4)")) return false;
49 if (feedback
!= 4) return false;
51 if (dostring(L
, "a2 = A(a)")) return false;
52 if (feedback
!= 21) return false;
54 if (dostring(L
, "b = B(6)")) return false;
55 if (feedback
!= 6) return false;
56 if (feedback2
!= 6) return false;
58 if (dostring(L
, "b2 = B()")) return false;
59 if (feedback
!= 20) return false;
60 if (feedback2
!= 20) return false;
62 // if (dostring(L, "a:f(a)")) return false;
65 if (feedback
!= -1) return false;
66 if (feedback2
!= -1) return false;
68 if (top
!= lua_gettop(L
)) return false;