sol2/tests/regression_tests/simple/source/1149 - static method gets const-morphed in internals.cpp
2021-03-07 13:43:56 -05:00

24 lines
498 B
C++

#include <sol/sol.hpp>
inline namespace sol2_regression_test_1149 {
struct Test {
static Test* staticCreate() {
return new Test();
}
Test* create() {
return new Test();
}
};
} // namespace sol2_regression_test_1149
unsigned int regression_1149() {
sol::state lua = {};
auto T = lua.new_usertype<Test>("Test");
// compile ok.
T.set_function("create", &Test::create);
// compile error.
T.set_function("staticCreate", &Test::staticCreate);
return 0;
}