Skip to content

Commit

Permalink
fix GCC compile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
gengyong committed Dec 12, 2023
1 parent 0d4a3cd commit 659e20e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions luaaa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ namespace LUAAA_NS
template <typename TCLASS, int TAG>
inline LuaModule& def(const char* name, const luaaa::LuaClass<TCLASS, TAG>&, const TCLASS* obj = nullptr, void(*deleter)(TCLASS*) = nullptr)
{
LuaClass<TCLASS, TAG>::UserDataDetail userData;
typename LuaClass<TCLASS, TAG>::UserDataDetail userData;
if (obj)
{
userData.obj = const_cast<TCLASS*>(obj);
Expand All @@ -1686,7 +1686,7 @@ namespace LUAAA_NS
struct HelperClass
{
typedef decltype(deleter) DELETERFTYPE;
static int f_dtor(LuaClass<TCLASS, TAG>::UserDataDetail* uData) {
static int f_dtor(typename LuaClass<TCLASS, TAG>::UserDataDetail* uData) {
if (uData && uData->obj && uData->free_func)
{
((DELETERFTYPE)(uData->free_func))(uData->obj);
Expand All @@ -1697,7 +1697,7 @@ namespace LUAAA_NS
};

userData.dtor = HelperClass::f_dtor;
userData.free_func = deleter;
userData.free_func = (void*)(deleter);
}
else
{
Expand All @@ -1709,7 +1709,7 @@ namespace LUAAA_NS
{
struct HelperClass
{
static int f_dtor(LuaClass<TCLASS, TAG>::UserDataDetail* uData)
static int f_dtor(typename LuaClass<TCLASS, TAG>::UserDataDetail* uData)
{
if (uData && uData->obj)
{
Expand All @@ -1731,7 +1731,7 @@ namespace LUAAA_NS
lua_pop(m_state, 1);
lua_newtable(m_state);
}
auto uData = (LuaClass<TCLASS, TAG>::UserDataDetail*)lua_newuserdata(m_state, sizeof(LuaClass<TCLASS, TAG>::UserDataDetail));
auto uData = (typename LuaClass<TCLASS, TAG>::UserDataDetail*)lua_newuserdata(m_state, sizeof(typename LuaClass<TCLASS, TAG>::UserDataDetail));
#if LUAAA_WITHOUT_CPP_STDLIB
luaL_argcheck(m_state, uData != nullptr, 1, "faild to alloc mem to store object");
#else
Expand Down

0 comments on commit 659e20e

Please sign in to comment.