You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many thanks for Luawrapper, it is amazing, and over at PowerDNS we plan to do big things with it. However, we ran into a snag.
Now this is probably due to clang 3.5 (OSX Yosemite) being wrong. I think it deducts that the function passed is const, which it is not.
Any use of registerFunction on an object errors out with:
./ext/luawrapper/include/LuaContext.hpp:1050:172: error: no matching function for call to object of type 'const std::__1::_mem_fn<void (Object::)()>'
setTable<TRetValue(TObject, TOtherParams...)>(mState, Registry, &typeid(TObject), 0, functionName, [=](TObject* obj, TOtherParams... rest) { assert(obj); return function(_obj, std::fo...
^~~~~~~~
./ext/luawrapper/include/LuaContext.hpp:1071:9: note: in instantiation of function template specialization 'LuaContext::registerFunctionImpl<std::__1::__mem_fn<void (Object::)()>, void,
Object>' requested here
registerFunctionImpl(functionName, std::move(function), tag{}, tag<TRetValue (TOtherParams...)>{});
^
./ext/luawrapper/include/LuaContext.hpp:350:9: note: in instantiation of function template specialization
'LuaContext::registerFunctionImpl<std::__1::__mem_fn<void (Object::)()>, void, Object>' requested here
registerFunctionImpl(name, std::mem_fn(pointer), tag{});
^
los.cc:17:7: note: in instantiation of function template specialization 'LuaContext::registerFunction<void (Object::)()>' requested here
lua.registerFunction("increment", &Object::increment);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1224:11: note: candidate function not viable: 'this' argument has type
'const std::__1::__mem_fn<void (Object::)()>', but method is not marked const
operator() (_ArgTypes&&... __args)
^
In file included from los.cc:1:
./ext/luawrapper/include/LuaContext.hpp:1053:227: error: no matching function for call to object of type 'const std::__1::__mem_fn<void (Object::*)()>'
...Registry, &typeid(std::shared_ptr), 0, functionName, [=](const std::shared_ptr& obj, TOtherParams... rest) { assert(obj); return function(obj, std::forward<TOtherPara...
^~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1224:11: note: candidate function not viable: 'this' argument has type
'const std::__1::__mem_fn<void (Object::)()>', but method is not marked const
operator() (_ArgTypes&&... __args)
This when compiling:
class Object {
public:
Object() : value(10) {}
void increment() { std::cout << "incrementing" << std::endl; value++; }
int value;
};
int main()
{
LuaContext lua;
lua.registerFunction("increment", &Object::increment);
}
I tried a lot of thing to work around this issue, but short of deleting the registration of the pointer and shared_ptr versions, I can't find anything..
Help ;-)
The text was updated successfully, but these errors were encountered:
Many thanks for Luawrapper, it is amazing, and over at PowerDNS we plan to do big things with it. However, we ran into a snag.
Now this is probably due to clang 3.5 (OSX Yosemite) being wrong. I think it deducts that the function passed is const, which it is not.
Any use of registerFunction on an object errors out with:
./ext/luawrapper/include/LuaContext.hpp:1050:172: error: no matching function for call to object of type 'const std::__1::_mem_fn<void (Object::)()>'
setTable<TRetValue(TObject, TOtherParams...)>(mState, Registry, &typeid(TObject), 0, functionName, [=](TObject* obj, TOtherParams... rest) { assert(obj); return function(_obj, std::fo...
^~~~~~~~
./ext/luawrapper/include/LuaContext.hpp:1071:9: note: in instantiation of function template specialization 'LuaContext::registerFunctionImpl<std::__1::__mem_fn<void (Object::)()>, void,
Object>' requested here
registerFunctionImpl(functionName, std::move(function), tag{}, tag<TRetValue (TOtherParams...)>{});
^
./ext/luawrapper/include/LuaContext.hpp:350:9: note: in instantiation of function template specialization
'LuaContext::registerFunctionImpl<std::__1::__mem_fn<void (Object::)()>, void, Object>' requested here
registerFunctionImpl(name, std::mem_fn(pointer), tag{});
^
los.cc:17:7: note: in instantiation of function template specialization 'LuaContext::registerFunction<void (Object::)()>' requested here
lua.registerFunction("increment", &Object::increment);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1224:11: note: candidate function not viable: 'this' argument has type
'const std::__1::__mem_fn<void (Object::)()>', but method is not marked const
operator() (_ArgTypes&&... __args)
^
In file included from los.cc:1:
./ext/luawrapper/include/LuaContext.hpp:1053:227: error: no matching function for call to object of type 'const std::__1::__mem_fn<void (Object::*)()>'
...Registry, &typeid(std::shared_ptr), 0, functionName, [=](const std::shared_ptr& obj, TOtherParams... rest) { assert(obj); return function(obj, std::forward<TOtherPara...
^~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1224:11: note: candidate function not viable: 'this' argument has type
'const std::__1::__mem_fn<void (Object::)()>', but method is not marked const
operator() (_ArgTypes&&... __args)
This when compiling:
class Object {
public:
Object() : value(10) {}
void increment() { std::cout << "incrementing" << std::endl; value++; }
int value;
};
int main()
{
LuaContext lua;
lua.registerFunction("increment", &Object::increment);
}
I tried a lot of thing to work around this issue, but short of deleting the registration of the pointer and shared_ptr versions, I can't find anything..
Help ;-)
The text was updated successfully, but these errors were encountered: