File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,21 @@ struct test_class2 : counted_type<test_class2>
48
48
{ return 1 ; }
49
49
};
50
50
51
+ struct test_class_unnamed : counted_type<test_class_unnamed>
52
+ {
53
+ test_class_unnamed () {}
54
+ int f () { return 42 ; }
55
+ };
56
+
57
+ test_class_unnamed create_unnamed ()
58
+ {
59
+ return test_class_unnamed ();
60
+ }
61
+
62
+
51
63
COUNTER_GUARD (test_class);
52
64
COUNTER_GUARD (test_class2);
65
+ COUNTER_GUARD (test_class_unnamed);
53
66
54
67
} // namespace unnamed
55
68
@@ -92,8 +105,12 @@ void test_main(lua_State* L)
92
105
namespace_ (" inner" )
93
106
[
94
107
def (" g" , &g_)
95
- ]
108
+ ],
96
109
110
+ class_<test_class_unnamed>()
111
+ .def (constructor<>())
112
+ .def (" f" , &test_class_unnamed::f),
113
+ def (" create_unnamed" , &create_unnamed)
97
114
];
98
115
99
116
module (L, " test" )
@@ -131,5 +148,11 @@ void test_main(lua_State* L)
131
148
132
149
globals (L)[" test_object" ] = test;
133
150
151
+ DOSTRING (L, " assert(not inner)" );
134
152
DOSTRING (L, " assert(test_object.inner.h() == 6)" );
153
+
154
+ DOSTRING (L, " assert(not test_class_unnamed)" );
155
+ DOSTRING (L,
156
+ " u = test.create_unnamed()\n "
157
+ " assert(u:f() == 42)" );
135
158
}
You can’t perform that action at this time.
0 commit comments