mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
clang chokes on statically casted constant function expressions, thanks clang
This commit is contained in:
parent
24d335085c
commit
e8a8da0b29
|
@ -151,10 +151,15 @@ namespace sol {
|
|||
|
||||
template <typename T, typename Regs, meta::enable<meta::has_size<T>> = 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<decltype(&T::size), &T::size> };
|
||||
#else
|
||||
typedef decltype(std::declval<T>().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<decltype(static_cast<sz_func>(&T::size)), static_cast<sz_func>(&T::size)> };
|
||||
#endif
|
||||
++index;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user