From 4e2ee29b34170333e4e54304834eff97885d4bce Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 14 Feb 2021 00:28:10 -0500 Subject: [PATCH] Get out of MSVC's crash on latest preview. - Honestly, no clue if this will even work... --- include/sol/proxy_base.hpp | 18 +++++++++++++++++- include/sol/stack_core.hpp | 8 +++++++- single/include/sol/config.hpp | 4 ++-- single/include/sol/forward.hpp | 4 ++-- single/include/sol/sol.hpp | 30 ++++++++++++++++++++++++++---- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/include/sol/proxy_base.hpp b/include/sol/proxy_base.hpp index 45839ca0..3b2d7784 100644 --- a/include/sol/proxy_base.hpp +++ b/include/sol/proxy_base.hpp @@ -63,7 +63,23 @@ namespace sol { return super.lua_state(); } - SOL_PROXY_BASE_IMPL_MSVC_IS_TRASH_I_(Super); + operator std::string() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } + + template >, is_proxy_primitive>> = meta::enabler> + operator T() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } + + template >, meta::neg>>> = meta::enabler> + operator T&() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } }; } // namespace sol diff --git a/include/sol/stack_core.hpp b/include/sol/stack_core.hpp index 10543cdc..5534fbf0 100644 --- a/include/sol/stack_core.hpp +++ b/include/sol/stack_core.hpp @@ -59,6 +59,12 @@ namespace sol { template struct as_table_tag { }; + template + inline constexpr bool is_tagged_v + = meta::is_specialization_of_v || meta::is_specialization_of_v || meta::is_specialization_of_v || meta::is_specialization_of_v || std::is_same_v || std::is_same_v; + using lua_reg_table = luaL_Reg[64]; using unique_destructor = void (*)(void*); @@ -938,7 +944,7 @@ namespace sol { else if constexpr (meta::meta_detail::is_adl_sol_lua_push_exact_v) { return sol_lua_push(types(), L, std::forward(arg), std::forward(args)...); } - else if constexpr (meta::meta_detail::is_adl_sol_lua_push_v) { + else if constexpr (meta::meta_detail::is_adl_sol_lua_push_v && !detail::is_tagged_v) { return sol_lua_push(L, std::forward(arg), std::forward(args)...); } else { diff --git a/single/include/sol/config.hpp b/single/include/sol/config.hpp index 7fd2e3a7..a371961d 100644 --- a/single/include/sol/config.hpp +++ b/single/include/sol/config.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 2021-02-10 17:29:50.720589 UTC -// This header was generated with sol v3.2.3 (revision b77f1a21) +// Generated 2021-02-14 05:27:32.027278 UTC +// This header was generated with sol v3.2.3 (revision 810c96b9) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_CONFIG_HPP diff --git a/single/include/sol/forward.hpp b/single/include/sol/forward.hpp index a086299e..3f418621 100644 --- a/single/include/sol/forward.hpp +++ b/single/include/sol/forward.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 2021-02-10 17:29:50.717841 UTC -// This header was generated with sol v3.2.3 (revision b77f1a21) +// Generated 2021-02-14 05:27:32.022278 UTC +// This header was generated with sol v3.2.3 (revision 810c96b9) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/single/include/sol/sol.hpp b/single/include/sol/sol.hpp index 0d76826d..cd7d118e 100644 --- a/single/include/sol/sol.hpp +++ b/single/include/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 2021-02-10 17:29:50.610143 UTC -// This header was generated with sol v3.2.3 (revision b77f1a21) +// Generated 2021-02-14 05:27:31.429278 UTC +// This header was generated with sol v3.2.3 (revision 810c96b9) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -10418,6 +10418,12 @@ namespace sol { template struct as_table_tag { }; + template + inline constexpr bool is_tagged_v + = meta::is_specialization_of_v || meta::is_specialization_of_v || meta::is_specialization_of_v || meta::is_specialization_of_v || std::is_same_v || std::is_same_v; + using lua_reg_table = luaL_Reg[64]; using unique_destructor = void (*)(void*); @@ -11296,7 +11302,7 @@ namespace sol { else if constexpr (meta::meta_detail::is_adl_sol_lua_push_exact_v) { return sol_lua_push(types(), L, std::forward(arg), std::forward(args)...); } - else if constexpr (meta::meta_detail::is_adl_sol_lua_push_v) { + else if constexpr (meta::meta_detail::is_adl_sol_lua_push_v && !detail::is_tagged_v) { return sol_lua_push(L, std::forward(arg), std::forward(args)...); } else { @@ -16425,7 +16431,23 @@ namespace sol { return super.lua_state(); } - SOL_PROXY_BASE_IMPL_MSVC_IS_TRASH_I_(Super); + operator std::string() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } + + template >, is_proxy_primitive>> = meta::enabler> + operator T() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } + + template >, meta::neg>>> = meta::enabler> + operator T&() const { + const Super& super = *static_cast(static_cast(this)); + return super.template get(); + } }; } // namespace sol