Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sol::light compile error #1354

Closed
qinix opened this issue May 14, 2022 · 1 comment
Closed

sol::light compile error #1354

qinix opened this issue May 14, 2022 · 1 comment

Comments

@qinix
Copy link
Contributor

qinix commented May 14, 2022

I got following error when using sol::light

/.../sol2/include/sol/stack_push.hpp:655:29: error: invalid ‘static_cast’ from type ‘<unresolved overloaded function type>’ to type ‘void*’
  655 |    lua_pushlightuserdata(L, static_cast<void*>(l.value));
      | 

After diving the source code, I found inconsistency on unqualified_pusher<light<T>>. The unqualified_pusher<light<T>> is using light<T>.value as a pointer, but in light<T>'s definition, light<T>.valule is a function returning a pointer.

template <typename T>
struct unqualified_pusher<light<T>> {
static int push(lua_State* L, light<T> l) noexcept {
#if SOL_IS_ON(SOL_SAFE_STACK_CHECK_I_)
luaL_checkstack(L, 1, detail::not_enough_stack_space_generic);
#endif // make sure stack doesn't overflow
lua_pushlightuserdata(L, static_cast<void*>(l.value));
return 1;
}
};

sol2/include/sol/types.hpp

Lines 236 to 238 in 6409634

T* value() const {
return m_value;
}

@qinix
Copy link
Contributor Author

qinix commented May 14, 2022

qinix added a commit to qinix/sol2 that referenced this issue May 14, 2022
@ThePhD ThePhD closed this as completed in c905547 Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant