From e8a8da0b29fbe2ea1bff7cf63c2da86dd92083e8 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Thu, 22 Feb 2018 18:33:40 -0500 Subject: [PATCH] clang chokes on statically casted constant function expressions, thanks clang --- sol/usertype_core.hpp | 5 +++++ 1 file changed, 5 insertions(+) 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; }