From b811e73b902ff151bc4c7fe8d19c67e530fbf277 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 17 Jun 2017 00:43:26 -0400 Subject: [PATCH] who knew noexcept proofing would be so hard...? And there's so many places it could be activated in...! --- single/sol/sol.hpp | 407 ++++++++++++++++----------- sol/bind_traits.hpp | 45 +-- sol/call.hpp | 8 + sol/compatibility.hpp | 1 + sol/compatibility/version.hpp | 83 +----- sol/container_usertype_metatable.hpp | 18 +- sol/feature_test.hpp | 106 +++++++ sol/function_types_stateless.hpp | 31 +- sol/function_types_templated.hpp | 12 +- sol/simple_usertype_metatable.hpp | 4 +- sol/types.hpp | 30 +- sol/usertype_metatable.hpp | 8 +- sol/wrapper.hpp | 8 +- 13 files changed, 446 insertions(+), 315 deletions(-) create mode 100644 sol/feature_test.hpp diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 2f2121f8..8d137cae 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-06-16 19:36:12.857631 UTC -// This header was generated with sol v2.17.5 (revision 39fdb5e) +// Generated 2017-06-17 04:42:58.829253 UTC +// This header was generated with sol v2.17.5 (revision 11916a7) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -47,6 +47,9 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wconversion" +#if __GNUC__ > 6 +#pragma GCC diagnostic ignored "-Wnoexcept-type" +#endif #elif defined _MSC_VER #pragma warning( push ) #pragma warning( disable : 4324 ) // structure was padded due to alignment specifier @@ -160,6 +163,84 @@ namespace sol { // beginning of sol/bind_traits.hpp +// beginning of sol/feature_test.hpp + +#if defined(__cpp_noexcept_function_type) +#ifndef SOL_NOEXCEPT_FUNCTION_TYPE +#define SOL_NOEXCEPT_FUNCTION_TYPE 1 +#endif // noexcept is part of a function's type +#endif + +#if defined(_WIN32) || defined(_MSC_VER) +#ifndef SOL_CODECVT_SUPPORT +#define SOL_CODECVT_SUPPORT 1 +#endif // sol codecvt support +#elif defined(__GNUC__) +#if __GNUC__ >= 5 +#ifndef SOL_CODECVT_SUPPORT +#define SOL_CODECVT_SUPPORT 1 +#endif // codecvt support +#endif // g++ 5.x.x (MinGW too) +#else +#endif // Windows/VC++ vs. g++ vs Others + +#ifdef _MSC_VER +#ifdef _DEBUG +#ifndef NDEBUG +#ifndef SOL_CHECK_ARGUMENTS +#endif // Check Arguments +#ifndef SOL_SAFE_USERTYPE +#define SOL_SAFE_USERTYPE +#endif // Safe Usertypes +#endif // NDEBUG +#endif // Debug + +#ifndef _CPPUNWIND +#ifndef SOL_NO_EXCEPTIONS +#define SOL_NO_EXCEPTIONS 1 +#endif +#endif // Automatic Exceptions + +#ifndef _CPPRTTI +#ifndef SOL_NO_RTTI +#define SOL_NO_RTTI 1 +#endif +#endif // Automatic RTTI + +#elif defined(__GNUC__) || defined(__clang__) + +#ifndef NDEBUG +#ifndef __OPTIMIZE__ +#ifndef SOL_CHECK_ARGUMENTS +#endif // Check Arguments +#ifndef SOL_SAFE_USERTYPE +#define SOL_SAFE_USERTYPE +#endif // Safe Usertypes +#endif // g++ optimizer flag +#endif // Not Debug + +#ifndef __EXCEPTIONS +#ifndef SOL_NO_EXCEPTIONS +#define SOL_NO_EXCEPTIONS 1 +#endif +#endif // No Exceptions + +#ifndef __GXX_RTTI +#ifndef SOL_NO_RTII +#define SOL_NO_RTTI 1 +#endif +#endif // No RTTI + +#endif // vc++ || clang++/g++ + +#ifndef SOL_SAFE_USERTYPE +#ifdef SOL_CHECK_ARGUMENTS +#define SOL_SAFE_USERTYPE +#endif // Turn on Safety for all +#endif // Safe Usertypes + +// end of sol/feature_test.hpp + namespace sol { namespace meta { namespace meta_detail { @@ -337,113 +418,113 @@ namespace sol { template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args...); + typedef R(*function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args...); + typedef R(*function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args..., ...); + typedef R(*function_pointer_type)(Args..., ...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args..., ...); + typedef R(*function_pointer_type)(Args..., ...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...); + typedef R(T::* function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...); + typedef R(T::* function_pointer_type)(Args..., ...) noexcept; }; /* Const Volatile */ template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const; + typedef R(T::* function_pointer_type)(Args...) const noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const; + typedef R(T::* function_pointer_type)(Args..., ...) const noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile; + typedef R(T::* function_pointer_type)(Args...) const volatile noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) &; + typedef R(T::* function_pointer_type)(Args...) & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) &; + typedef R(T::* function_pointer_type)(Args..., ...) & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const &; + typedef R(T::* function_pointer_type)(Args...) const & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const &; + typedef R(T::* function_pointer_type)(Args..., ...) const & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile &; + typedef R(T::* function_pointer_type)(Args...) const volatile & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile &; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) && ; + typedef R(T::* function_pointer_type)(Args...) && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) && ; + typedef R(T::* function_pointer_type)(Args..., ...) && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const &&; + typedef R(T::* function_pointer_type)(Args...) const && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const &&; + typedef R(T::* function_pointer_type)(Args..., ...) const && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile &&; + typedef R(T::* function_pointer_type)(Args...) const volatile && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile &&; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile && noexcept; }; #endif // noexcept is part of a function's type @@ -938,25 +1019,6 @@ namespace sol { #include #endif // C++ Mangling for Lua -#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510L) -#ifndef SOL_NOEXCEPT_FUNCTION_TYPE -#define SOL_NOEXCEPT_FUNCTION_TYPE 1 -#endif // noexcept is part of a function's type -#endif - -#if defined(_WIN32) || defined(_MSC_VER) -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // sol codecvt support -#elif defined(__GNUC__) -#if __GNUC__ >= 5 -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // codecvt support -#endif // g++ 5.x.x (MinGW too) -#else -#endif // Windows/VC++ vs. g++ vs Others - #ifdef LUAJIT_VERSION #ifndef SOL_LUAJIT #define SOL_LUAJIT @@ -974,61 +1036,6 @@ namespace sol { #define SOL_LUA_VERSION 502 #endif // Lua Version 502, 501 || luajit, 500 -#ifdef _MSC_VER -#ifdef _DEBUG -#ifndef NDEBUG -#ifndef SOL_CHECK_ARGUMENTS -#endif // Check Arguments -#ifndef SOL_SAFE_USERTYPE -#define SOL_SAFE_USERTYPE -#endif // Safe Usertypes -#endif // NDEBUG -#endif // Debug - -#ifndef _CPPUNWIND -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // Automatic Exceptions - -#ifndef _CPPRTTI -#ifndef SOL_NO_RTTI -#define SOL_NO_RTTI 1 -#endif -#endif // Automatic RTTI - -#elif defined(__GNUC__) || defined(__clang__) - -#ifndef NDEBUG -#ifndef __OPTIMIZE__ -#ifndef SOL_CHECK_ARGUMENTS -#endif // Check Arguments -#ifndef SOL_SAFE_USERTYPE -#define SOL_SAFE_USERTYPE -#endif // Safe Usertypes -#endif // g++ optimizer flag -#endif // Not Debug - -#ifndef __EXCEPTIONS -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // No Exceptions - -#ifndef __GXX_RTTI -#ifndef SOL_NO_RTII -#define SOL_NO_RTTI 1 -#endif -#endif // No RTTI - -#endif // vc++ || clang++/g++ - -#ifndef SOL_SAFE_USERTYPE -#ifdef SOL_CHECK_ARGUMENTS -#define SOL_SAFE_USERTYPE -#endif // Turn on Safety for all -#endif // Safe Usertypes - // end of sol/compatibility/version.hpp #ifndef SOL_NO_COMPAT @@ -3172,16 +3179,23 @@ namespace sol { #ifdef SOL_NO_EXCEPTIONS template - int static_trampoline(lua_State* L) { + int static_trampoline(lua_State* L) noexcept { return f(L); } +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + template + int static_trampoline_noexcept(lua_State* L) noexcept { + return f(L); + } +#endif + template - int trampoline(lua_State* L, Fx&& f, Args&&... args) { + int trampoline(lua_State* L, Fx&& f, Args&&... args) noexcept { return f(L, std::forward(args)...); } - inline int c_trampoline(lua_State* L, lua_CFunction f) { + inline int c_trampoline(lua_State* L, lua_CFunction f) noexcept { return trampoline(L, f); } #else @@ -3198,7 +3212,6 @@ namespace sol { } #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) catch (...) { - std::exception_ptr eptr = std::current_exception(); lua_pushstring(L, "caught (...) exception"); } #endif @@ -3206,24 +3219,20 @@ namespace sol { } #ifdef SOL_NOEXCEPT_FUNCTION_TYPE +#if 0 template - int static_trampoline(lua_State* L) { - try { - return f(L); - } - catch (const char *s) { - lua_pushstring(L, s); - } - catch (const std::exception& e) { - lua_pushstring(L, e.what()); - } -#if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) - catch (...) { - std::exception_ptr eptr = std::current_exception(); - lua_pushstring(L, "caught (...) exception"); - } -#endif - return lua_error(L); + int static_trampoline(lua_State* L) noexcept { +#else + template + int static_trampoline_noexcept(lua_State* L) noexcept { +#endif // impossible + return f(L); + } + +#else + template + int static_trampoline_noexcept(lua_State* L) noexcept { + return f(L); } #endif // noexcept lua_CFunction type @@ -3254,6 +3263,21 @@ namespace sol { } #endif // Exceptions vs. No Exceptions + template + inline int typed_static_trampoline_raw(std::true_type, lua_State* L) { + return static_trampoline_noexcept(L); + } + + template + inline int typed_static_trampoline_raw(std::false_type, lua_State* L) { + return static_trampoline(L); + } + + template + inline int typed_static_trampoline(lua_State* L) { + return typed_static_trampoline_raw(std::integral_constant::is_noexcept>(), L); + } + template struct unique_usertype {}; @@ -6788,6 +6812,23 @@ namespace sol { return 1; } }; +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + template<> + struct pusher> { + static int push(lua_State* L, detail::lua_CFunction_noexcept func, int n = 0) { + lua_pushcclosure(L, func, n); + return 1; + } + }; + + template<> + struct pusher { + static int push(lua_State* L, detail::lua_CFunction_noexcept func, int n = 0) { + lua_pushcclosure(L, func, n); + return 1; + } + }; +#endif // noexcept function type template<> struct pusher { @@ -7977,7 +8018,7 @@ namespace sol { template struct wrapper { - typedef lua_bind_traits traits_type; + typedef lua_bind_traits> traits_type; typedef typename traits_type::args_list args_list; typedef typename traits_type::args_list free_args_list; typedef typename traits_type::returns_list returns_list; @@ -7996,8 +8037,8 @@ namespace sol { }; template - struct wrapper>>::value>> { - typedef lua_bind_traits traits_type; + struct wrapper>>::value>> { + typedef lua_bind_traits>> traits_type; typedef typename traits_type::args_list args_list; typedef typename traits_type::args_list free_args_list; typedef typename traits_type::returns_list returns_list; @@ -8030,7 +8071,7 @@ namespace sol { template struct wrapper>::value>> { - typedef lua_bind_traits traits_type; + typedef lua_bind_traits> traits_type; typedef typename traits_type::object_type object_type; typedef typename traits_type::return_type return_type; typedef typename traits_type::args_list args_list; @@ -8630,6 +8671,14 @@ namespace sol { return f(L); } }; +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + template + struct agnostic_lua_call_wrapper { + static int call(lua_State* L, detail::lua_CFunction_noexcept f) { + return f(L); + } + }; +#endif // noexcept function types template struct agnostic_lua_call_wrapper { @@ -9113,7 +9162,7 @@ namespace sol { } template - int call_wrapper_entry(lua_State* L) { + int call_wrapper_entry(lua_State* L) noexcept(meta::bind_traits::is_noexcept) { return call_wrapper_function(std::is_member_function_pointer>(), L); } @@ -9126,15 +9175,30 @@ namespace sol { } }; + template + inline int c_call_raw(std::true_type, lua_State* L) { + return fx(L); + } + + template + inline int c_call_raw(std::false_type, lua_State* L) { +#ifdef __clang__ + return detail::trampoline(L, function_detail::call_wrapper_entry); +#else + return detail::typed_static_trampoline), &function_detail::call_wrapper_entry>(L); +#endif // fuck you clang :c + } + } // function_detail template inline int c_call(lua_State* L) { -#ifdef __clang__ - return detail::trampoline(L, function_detail::call_wrapper_entry); -#else - return detail::static_trampoline<(&function_detail::call_wrapper_entry)>(L); -#endif // fuck you clang :c + typedef meta::unqualified_t Fu; + return function_detail::c_call_raw(std::integral_constant::value +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + || std::is_same::value +#endif + >(), L); } template @@ -9167,16 +9231,16 @@ namespace sol { template struct upvalue_free_function { typedef std::remove_pointer_t> function_type; - typedef lua_bind_traits traits_type; + typedef meta::bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { auto udata = stack::stack_detail::get_as_upvalues(L); function_type* fx = udata.first; return call_detail::call_wrapped(L, fx); } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9189,7 +9253,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member function pointer // idx n + 1: is the object's void pointer @@ -9203,7 +9267,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9216,7 +9280,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer // idx n + 1: is the object's void pointer @@ -9237,7 +9301,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9250,7 +9314,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer // idx n + 1: is the object's void pointer @@ -9269,7 +9333,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9282,7 +9346,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -9291,7 +9355,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9302,9 +9366,8 @@ namespace sol { template struct upvalue_this_member_variable { typedef std::remove_pointer_t> function_type; - typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(false) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -9320,7 +9383,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9333,7 +9396,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(false) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -9347,7 +9410,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -9365,11 +9428,11 @@ namespace sol { namespace function_detail { template struct functor_function { - typedef meta::unwrapped_t> Function; - Function fx; + typedef std::decay_t> function_type; + function_type fx; template - functor_function(Function f, Args&&... args) : fx(std::move(f), std::forward(args)...) {} + functor_function(function_type f, Args&&... args) : fx(std::move(f), std::forward(args)...) {} int call(lua_State* L) { return call_detail::call_wrapped(L, fx); @@ -9779,9 +9842,15 @@ namespace sol { stack::push(L, f); } +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + static void select_function(std::true_type, lua_State* L, detail::lua_CFunction_noexcept f) { + stack::push(L, f); + } +#endif // noexcept function type + template >, std::is_base_of>>> = meta::enabler> static void select(lua_State* L, Fx&& fx, Args&&... args) { - select_function(std::is_function>(), L, std::forward(fx), std::forward(args)...); + select_function(std::is_function>>(), L, std::forward(fx), std::forward(args)...); } template >, std::is_base_of>>> = meta::enabler> @@ -9843,7 +9912,15 @@ namespace sol { }; template - struct pusher, meta::neg>, meta::neg>>>::value>> { + struct pusher, + meta::neg>, + meta::neg>> +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + , meta::neg>, + meta::neg>> +#endif // noexcept function types + >::value>> { template static int push(lua_State* L, F&& f) { return pusher>{}.push(L, std::forward(f)); @@ -11623,20 +11700,20 @@ namespace sol { template static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline), (&real_call)>(L); } template static int call_with(lua_State* L) { - return detail::static_trampoline<(&real_call_with)>(L); + return detail::typed_static_trampoline), (&real_call_with)>(L); } static int index_call(lua_State* L) { - return detail::static_trampoline<(&real_index_call)>(L); + return detail::typed_static_trampoline(L); } static int new_index_call(lua_State* L) { - return detail::static_trampoline<(&real_new_index_call)>(L); + return detail::typed_static_trampoline(L); } virtual int push_um(lua_State* L) override { @@ -11922,7 +11999,7 @@ namespace sol { #if defined(__clang__) return detail::trampoline(L, &simple_real_index_call); #else - return detail::static_trampoline<(&simple_real_index_call)>(L); + return detail::typed_static_trampoline), (&simple_real_index_call)>(L); #endif } @@ -11931,7 +12008,7 @@ namespace sol { #if defined(__clang__) return detail::trampoline(L, &simple_real_new_index_call); #else - return detail::static_trampoline<(&simple_real_new_index_call)>(L); + return detail::typed_static_trampoline), (&simple_real_new_index_call)>(L); #endif } } @@ -12790,39 +12867,39 @@ namespace sol { } static int add_call(lua_State*L) { - return detail::static_trampoline<(&real_add_call)>(L); + return detail::typed_static_trampoline(L); } static int insert_call(lua_State*L) { - return detail::static_trampoline<(&real_insert_call)>(L); + return detail::typed_static_trampoline(L); } static int clear_call(lua_State*L) { - return detail::static_trampoline<(&real_clear_call)>(L); + return detail::typed_static_trampoline(L); } static int find_call(lua_State*L) { - return detail::static_trampoline<(&real_find_call)>(L); + return detail::typed_static_trampoline(L); } static int length_call(lua_State*L) { - return detail::static_trampoline<(&real_length_call)>(L); + return detail::typed_static_trampoline(L); } static int pairs_next_call(lua_State*L) { - return detail::static_trampoline<(&real_pairs_next_call)>(L); + return detail::typed_static_trampoline(L); } static int pairs_call(lua_State*L) { - return detail::static_trampoline<(&real_pairs_call)>(L); + return detail::typed_static_trampoline(L); } static int index_call(lua_State*L) { - return detail::static_trampoline<(&real_index_call)>(L); + return detail::typed_static_trampoline(L); } static int new_index_call(lua_State*L) { - return detail::static_trampoline<(&real_new_index_call)>(L); + return detail::typed_static_trampoline(L); } }; diff --git a/sol/bind_traits.hpp b/sol/bind_traits.hpp index 5cfb83ca..a06b3eb7 100644 --- a/sol/bind_traits.hpp +++ b/sol/bind_traits.hpp @@ -22,6 +22,7 @@ #ifndef SOL_BIND_TRAITS_HPP #define SOL_BIND_TRAITS_HPP +#include "feature_test.hpp" #include "tuple.hpp" namespace sol { @@ -201,113 +202,113 @@ namespace sol { template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args...); + typedef R(*function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args...); + typedef R(*function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args..., ...); + typedef R(*function_pointer_type)(Args..., ...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(*function_pointer_type)(Args..., ...); + typedef R(*function_pointer_type)(Args..., ...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...); + typedef R(T::* function_pointer_type)(Args...) noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...); + typedef R(T::* function_pointer_type)(Args..., ...) noexcept; }; /* Const Volatile */ template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const; + typedef R(T::* function_pointer_type)(Args...) const noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const; + typedef R(T::* function_pointer_type)(Args..., ...) const noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile; + typedef R(T::* function_pointer_type)(Args...) const volatile noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) &; + typedef R(T::* function_pointer_type)(Args...) & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) &; + typedef R(T::* function_pointer_type)(Args..., ...) & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const &; + typedef R(T::* function_pointer_type)(Args...) const & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const &; + typedef R(T::* function_pointer_type)(Args..., ...) const & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile &; + typedef R(T::* function_pointer_type)(Args...) const volatile & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile &; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile & noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) && ; + typedef R(T::* function_pointer_type)(Args...) && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) && ; + typedef R(T::* function_pointer_type)(Args..., ...) && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const &&; + typedef R(T::* function_pointer_type)(Args...) const && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const &&; + typedef R(T::* function_pointer_type)(Args..., ...) const && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args...) const volatile &&; + typedef R(T::* function_pointer_type)(Args...) const volatile && noexcept; }; template struct fx_traits : basic_traits { - typedef R(T::* function_pointer_type)(Args..., ...) const volatile &&; + typedef R(T::* function_pointer_type)(Args..., ...) const volatile && noexcept; }; #endif // noexcept is part of a function's type diff --git a/sol/call.hpp b/sol/call.hpp index d68ee80e..8fd1a54d 100644 --- a/sol/call.hpp +++ b/sol/call.hpp @@ -239,6 +239,14 @@ namespace sol { return f(L); } }; +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + template + struct agnostic_lua_call_wrapper { + static int call(lua_State* L, detail::lua_CFunction_noexcept f) { + return f(L); + } + }; +#endif // noexcept function types template struct agnostic_lua_call_wrapper { diff --git a/sol/compatibility.hpp b/sol/compatibility.hpp index 5a1c5d58..7f9787f2 100644 --- a/sol/compatibility.hpp +++ b/sol/compatibility.hpp @@ -27,6 +27,7 @@ // but has been modified in many places for use with Sol and luajit, // though the core abstractions remain the same +#include "feature_test.hpp" #include "compatibility/version.hpp" #ifndef SOL_NO_COMPAT diff --git a/sol/compatibility/version.hpp b/sol/compatibility/version.hpp index cb25ae1d..592e8c95 100644 --- a/sol/compatibility/version.hpp +++ b/sol/compatibility/version.hpp @@ -22,6 +22,8 @@ #ifndef SOL_VERSION_HPP #define SOL_VERSION_HPP +#include "../feature_test.hpp" + #ifdef SOL_USING_CXX_LUA #include #include @@ -30,27 +32,6 @@ #include #endif // C++ Mangling for Lua -#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510L) -#ifndef SOL_NOEXCEPT_FUNCTION_TYPE -#define SOL_NOEXCEPT_FUNCTION_TYPE 1 -#endif // noexcept is part of a function's type -#endif - -#if defined(_WIN32) || defined(_MSC_VER) -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // sol codecvt support -#elif defined(__GNUC__) -#if __GNUC__ >= 5 -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // codecvt support -#endif // g++ 5.x.x (MinGW too) -#else -// Clang sucks and doesn't really utilize codecvt support, -// not without checking the library versions explicitly (and we're not gonna do that, so fuck you) -#endif // Windows/VC++ vs. g++ vs Others - #ifdef LUAJIT_VERSION #ifndef SOL_LUAJIT #define SOL_LUAJIT @@ -70,64 +51,4 @@ #define SOL_LUA_VERSION 502 #endif // Lua Version 502, 501 || luajit, 500 -#ifdef _MSC_VER -#ifdef _DEBUG -#ifndef NDEBUG -#ifndef SOL_CHECK_ARGUMENTS -// Do not define by default: let user turn it on -//#define SOL_CHECK_ARGUMENTS -#endif // Check Arguments -#ifndef SOL_SAFE_USERTYPE -#define SOL_SAFE_USERTYPE -#endif // Safe Usertypes -#endif // NDEBUG -#endif // Debug - -#ifndef _CPPUNWIND -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // Automatic Exceptions - -#ifndef _CPPRTTI -#ifndef SOL_NO_RTTI -#define SOL_NO_RTTI 1 -#endif -#endif // Automatic RTTI - -#elif defined(__GNUC__) || defined(__clang__) - -#ifndef NDEBUG -#ifndef __OPTIMIZE__ -#ifndef SOL_CHECK_ARGUMENTS -// Do not define by default: let user choose -//#define SOL_CHECK_ARGUMENTS -// But do check userdata by default: -#endif // Check Arguments -#ifndef SOL_SAFE_USERTYPE -#define SOL_SAFE_USERTYPE -#endif // Safe Usertypes -#endif // g++ optimizer flag -#endif // Not Debug - -#ifndef __EXCEPTIONS -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // No Exceptions - -#ifndef __GXX_RTTI -#ifndef SOL_NO_RTII -#define SOL_NO_RTTI 1 -#endif -#endif // No RTTI - -#endif // vc++ || clang++/g++ - -#ifndef SOL_SAFE_USERTYPE -#ifdef SOL_CHECK_ARGUMENTS -#define SOL_SAFE_USERTYPE -#endif // Turn on Safety for all -#endif // Safe Usertypes - #endif // SOL_VERSION_HPP diff --git a/sol/container_usertype_metatable.hpp b/sol/container_usertype_metatable.hpp index 68d1faf9..8f223d9e 100644 --- a/sol/container_usertype_metatable.hpp +++ b/sol/container_usertype_metatable.hpp @@ -457,39 +457,39 @@ namespace sol { } static int add_call(lua_State*L) { - return detail::static_trampoline<(&real_add_call)>(L); + return detail::typed_static_trampoline(L); } static int insert_call(lua_State*L) { - return detail::static_trampoline<(&real_insert_call)>(L); + return detail::typed_static_trampoline(L); } static int clear_call(lua_State*L) { - return detail::static_trampoline<(&real_clear_call)>(L); + return detail::typed_static_trampoline(L); } static int find_call(lua_State*L) { - return detail::static_trampoline<(&real_find_call)>(L); + return detail::typed_static_trampoline(L); } static int length_call(lua_State*L) { - return detail::static_trampoline<(&real_length_call)>(L); + return detail::typed_static_trampoline(L); } static int pairs_next_call(lua_State*L) { - return detail::static_trampoline<(&real_pairs_next_call)>(L); + return detail::typed_static_trampoline(L); } static int pairs_call(lua_State*L) { - return detail::static_trampoline<(&real_pairs_call)>(L); + return detail::typed_static_trampoline(L); } static int index_call(lua_State*L) { - return detail::static_trampoline<(&real_index_call)>(L); + return detail::typed_static_trampoline(L); } static int new_index_call(lua_State*L) { - return detail::static_trampoline<(&real_new_index_call)>(L); + return detail::typed_static_trampoline(L); } }; diff --git a/sol/feature_test.hpp b/sol/feature_test.hpp new file mode 100644 index 00000000..5048a24b --- /dev/null +++ b/sol/feature_test.hpp @@ -0,0 +1,106 @@ +// The MIT License (MIT) + +// Copyright (c) 2013-2017 Rapptz, ThePhD and contributors + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#ifndef SOL_FEATURE_TEST_HPP +#define SOL_FEATURE_TEST_HPP + +#if defined(__cpp_noexcept_function_type) +#ifndef SOL_NOEXCEPT_FUNCTION_TYPE +#define SOL_NOEXCEPT_FUNCTION_TYPE 1 +#endif // noexcept is part of a function's type +#endif + +#if defined(_WIN32) || defined(_MSC_VER) +#ifndef SOL_CODECVT_SUPPORT +#define SOL_CODECVT_SUPPORT 1 +#endif // sol codecvt support +#elif defined(__GNUC__) +#if __GNUC__ >= 5 +#ifndef SOL_CODECVT_SUPPORT +#define SOL_CODECVT_SUPPORT 1 +#endif // codecvt support +#endif // g++ 5.x.x (MinGW too) +#else +// Clang sucks and doesn't really utilize codecvt support, +// not without checking the library versions explicitly (and we're not gonna do that, so fuck you) +#endif // Windows/VC++ vs. g++ vs Others + +#ifdef _MSC_VER +#ifdef _DEBUG +#ifndef NDEBUG +#ifndef SOL_CHECK_ARGUMENTS +// Do not define by default: let user turn it on +//#define SOL_CHECK_ARGUMENTS +#endif // Check Arguments +#ifndef SOL_SAFE_USERTYPE +#define SOL_SAFE_USERTYPE +#endif // Safe Usertypes +#endif // NDEBUG +#endif // Debug + +#ifndef _CPPUNWIND +#ifndef SOL_NO_EXCEPTIONS +#define SOL_NO_EXCEPTIONS 1 +#endif +#endif // Automatic Exceptions + +#ifndef _CPPRTTI +#ifndef SOL_NO_RTTI +#define SOL_NO_RTTI 1 +#endif +#endif // Automatic RTTI + +#elif defined(__GNUC__) || defined(__clang__) + +#ifndef NDEBUG +#ifndef __OPTIMIZE__ +#ifndef SOL_CHECK_ARGUMENTS +// Do not define by default: let user choose +//#define SOL_CHECK_ARGUMENTS +// But do check userdata by default: +#endif // Check Arguments +#ifndef SOL_SAFE_USERTYPE +#define SOL_SAFE_USERTYPE +#endif // Safe Usertypes +#endif // g++ optimizer flag +#endif // Not Debug + +#ifndef __EXCEPTIONS +#ifndef SOL_NO_EXCEPTIONS +#define SOL_NO_EXCEPTIONS 1 +#endif +#endif // No Exceptions + +#ifndef __GXX_RTTI +#ifndef SOL_NO_RTII +#define SOL_NO_RTTI 1 +#endif +#endif // No RTTI + +#endif // vc++ || clang++/g++ + +#ifndef SOL_SAFE_USERTYPE +#ifdef SOL_CHECK_ARGUMENTS +#define SOL_SAFE_USERTYPE +#endif // Turn on Safety for all +#endif // Safe Usertypes + +#endif // SOL_FEATURE_TEST_HPP diff --git a/sol/function_types_stateless.hpp b/sol/function_types_stateless.hpp index 36777550..20239d99 100644 --- a/sol/function_types_stateless.hpp +++ b/sol/function_types_stateless.hpp @@ -29,16 +29,16 @@ namespace sol { template struct upvalue_free_function { typedef std::remove_pointer_t> function_type; - typedef lua_bind_traits traits_type; + typedef meta::bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { auto udata = stack::stack_detail::get_as_upvalues(L); function_type* fx = udata.first; return call_detail::call_wrapped(L, fx); } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -51,7 +51,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member function pointer // idx n + 1: is the object's void pointer @@ -65,7 +65,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -78,7 +78,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer // idx n + 1: is the object's void pointer @@ -99,7 +99,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -112,7 +112,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer // idx n + 1: is the object's void pointer @@ -131,7 +131,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -144,7 +144,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -153,7 +153,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -164,9 +164,8 @@ namespace sol { template struct upvalue_this_member_variable { typedef std::remove_pointer_t> function_type; - typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(false) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -182,7 +181,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { @@ -195,7 +194,7 @@ namespace sol { typedef std::remove_pointer_t> function_type; typedef lua_bind_traits traits_type; - static int real_call(lua_State* L) { + static int real_call(lua_State* L) noexcept(false) { // Layout: // idx 1...n: verbatim data of member variable pointer auto memberdata = stack::stack_detail::get_as_upvalues(L); @@ -209,7 +208,7 @@ namespace sol { } static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline(L); } int operator()(lua_State* L) { diff --git a/sol/function_types_templated.hpp b/sol/function_types_templated.hpp index 533ea359..3c72f4b6 100644 --- a/sol/function_types_templated.hpp +++ b/sol/function_types_templated.hpp @@ -99,15 +99,7 @@ namespace sol { template inline int c_call_raw(std::true_type, lua_State* L) { -#ifdef __clang__ - return detail::trampoline(L, fx); -#else -#ifdef SOL_NOEXCEPT_FUNCTION_TYPE - return meta::bind_traits::is_noexcept ? detail::static_trampoline_noexcept(L) : detail::static_trampoline(L); -#else - return detail::static_trampoline(L); -#endif -#endif // fuck you clang :c + return fx(L); } template @@ -115,7 +107,7 @@ namespace sol { #ifdef __clang__ return detail::trampoline(L, function_detail::call_wrapper_entry); #else - return detail::static_trampoline<(&function_detail::call_wrapper_entry)>(L); + return detail::typed_static_trampoline), &function_detail::call_wrapper_entry>(L); #endif // fuck you clang :c } diff --git a/sol/simple_usertype_metatable.hpp b/sol/simple_usertype_metatable.hpp index fa4ab9ab..8ba64c5c 100644 --- a/sol/simple_usertype_metatable.hpp +++ b/sol/simple_usertype_metatable.hpp @@ -152,7 +152,7 @@ namespace sol { #if defined(__clang__) return detail::trampoline(L, &simple_real_index_call); #else - return detail::static_trampoline<(&simple_real_index_call)>(L); + return detail::typed_static_trampoline), (&simple_real_index_call)>(L); #endif } @@ -161,7 +161,7 @@ namespace sol { #if defined(__clang__) return detail::trampoline(L, &simple_real_new_index_call); #else - return detail::static_trampoline<(&simple_real_new_index_call)>(L); + return detail::typed_static_trampoline), (&simple_real_new_index_call)>(L); #endif } } diff --git a/sol/types.hpp b/sol/types.hpp index 896da0aa..7b01bfc6 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -41,6 +41,13 @@ namespace sol { return f(L); } +#ifdef SOL_NOEXCEPT_FUNCTION_TYPE + template + int static_trampoline_noexcept(lua_State* L) noexcept { + return f(L); + } +#endif + template int trampoline(lua_State* L, Fx&& f, Args&&... args) noexcept { return f(L, std::forward(args)...); @@ -79,7 +86,12 @@ namespace sol { template int static_trampoline_noexcept(lua_State* L) noexcept { #endif // impossible - std::cout << "[STATIC_TRAMPOLINE] HEY A NOEXCEPTION FUNCTION IS GONNA BE CALLED" << std::endl; + return f(L); + } + +#else + template + int static_trampoline_noexcept(lua_State* L) noexcept { return f(L); } #endif // noexcept lua_CFunction type @@ -87,7 +99,6 @@ namespace sol { template int trampoline(lua_State* L, Fx&& f, Args&&... args) { if (meta::bind_traits>::is_noexcept) { - std::cout << "[TRAMPOLINE] HEY A NOEXCEPTION FUNCTION IS GONNA BE CALLED" << std::endl; return f(L, std::forward(args)...); } try { @@ -112,6 +123,21 @@ namespace sol { } #endif // Exceptions vs. No Exceptions + template + inline int typed_static_trampoline_raw(std::true_type, lua_State* L) { + return static_trampoline_noexcept(L); + } + + template + inline int typed_static_trampoline_raw(std::false_type, lua_State* L) { + return static_trampoline(L); + } + + template + inline int typed_static_trampoline(lua_State* L) { + return typed_static_trampoline_raw(std::integral_constant::is_noexcept>(), L); + } + template struct unique_usertype {}; diff --git a/sol/usertype_metatable.hpp b/sol/usertype_metatable.hpp index 196f3a4c..86c4526b 100644 --- a/sol/usertype_metatable.hpp +++ b/sol/usertype_metatable.hpp @@ -673,20 +673,20 @@ namespace sol { template static int call(lua_State* L) { - return detail::static_trampoline<(&real_call)>(L); + return detail::typed_static_trampoline), (&real_call)>(L); } template static int call_with(lua_State* L) { - return detail::static_trampoline<(&real_call_with)>(L); + return detail::typed_static_trampoline), (&real_call_with)>(L); } static int index_call(lua_State* L) { - return detail::static_trampoline<(&real_index_call)>(L); + return detail::typed_static_trampoline(L); } static int new_index_call(lua_State* L) { - return detail::static_trampoline<(&real_new_index_call)>(L); + return detail::typed_static_trampoline(L); } virtual int push_um(lua_State* L) override { diff --git a/sol/wrapper.hpp b/sol/wrapper.hpp index 712c0f36..43ff2a72 100644 --- a/sol/wrapper.hpp +++ b/sol/wrapper.hpp @@ -28,7 +28,7 @@ namespace sol { template struct wrapper { - typedef lua_bind_traits traits_type; + typedef lua_bind_traits> traits_type; typedef typename traits_type::args_list args_list; typedef typename traits_type::args_list free_args_list; typedef typename traits_type::returns_list returns_list; @@ -47,8 +47,8 @@ namespace sol { }; template - struct wrapper>>::value>> { - typedef lua_bind_traits traits_type; + struct wrapper>>::value>> { + typedef lua_bind_traits>> traits_type; typedef typename traits_type::args_list args_list; typedef typename traits_type::args_list free_args_list; typedef typename traits_type::returns_list returns_list; @@ -81,7 +81,7 @@ namespace sol { template struct wrapper>::value>> { - typedef lua_bind_traits traits_type; + typedef lua_bind_traits> traits_type; typedef typename traits_type::object_type object_type; typedef typename traits_type::return_type return_type; typedef typename traits_type::args_list args_list;