lua-api-pp
lua-api-pp copied to clipboard
Any calls to `Context::requireArgs` are not compiled.
Anytime this function is called, I'm getting quite verbose compile errors:
[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:405:6: error: call to member function 'push' is ambiguous
[build] S.push(V);
[build] ~~^~~~
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:442:12: note: in instantiation of member function 'lua::_::lazyImmediateValue<unsigned long>::push' requested here
[build] policy.push(S);
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:898:8: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyImmediateValue<unsigned long> >::push' requested here
[build] l2.push();
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_operations.hxx:162:25: note: in instantiation of function template specialization 'lua::_::lazyConcatSelector::pushOnly<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *, unsigned long>' requested here
[build] lazyConcatSelector::pushOnly(S, L1, L2);
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:454:12: note: in instantiation of member function 'lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long>::pushOnly' requested here
[build] policy.pushOnly(S);
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:728:10: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >::pushOnly' requested here
[build] lref.pushOnly();
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:454:12: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
[build] policy.pushOnly(S);
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:767:6: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> >::push' requested here
[build] l.push();
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:684:4: note: in instantiation of function template specialization 'lua::Context::push<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> >' requested here
[build] push(std::forward<T>(val));
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:294:4: note: in instantiation of function template specialization 'lua::Context::ipush<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> > >' requested here
[build] ipush(std::forward<MsgType>(msg));
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:1487:4: note: in instantiation of function template specialization 'lua::Context::error<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> > >' requested here
[build] error(where() & " Insufficient number of arguments (" & nArgsExpected & " expected, " & args.size() & " passed).");
[build] ^
[build] ../modules/Script/include/Script/Observer.hpp:20:17: note: in instantiation of function template specialization 'lua::Context::requireArgs<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' requested here
[build] context.requireArgs<std::string>(1);
[build] ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:697:8: note: candidate function
[build] void push(bool) noexcept;
[build] ^
<and many more possible candidate functions...>
I have diagnosed it and turns out that the Context class is lacking the following member function overloads:
void push(long val) noexcept;
void push(unsigned long val) noexcept;
It's because Context::requireArgs and Context::requireArg use string concatenation with the operator& overload combined with arguments of size_t. Adding the overloads above seems to have fixed this issue.