diff --git a/sol/usertype_core.hpp b/sol/usertype_core.hpp index cbfb5095..d45d6101 100644 --- a/sol/usertype_core.hpp +++ b/sol/usertype_core.hpp @@ -151,10 +151,15 @@ namespace sol { template > = meta::enabler> inline void make_length_op(Regs& l, int& index) { + const char* name = to_string(meta_function::length).c_str(); +#ifdef __clang__ + l[index] = luaL_Reg{ name, &c_call }; +#else typedef decltype(std::declval().size()) R; using sz_func = R(T::*)()const; const char* name = to_string(meta_function::length).c_str(); l[index] = luaL_Reg{ name, &c_call(&T::size)), static_cast(&T::size)> }; +#endif ++index; }