From fe8eb7338c4e4950f32664b485c474fb2c726f46 Mon Sep 17 00:00:00 2001 From: Vano Date: Fri, 16 Feb 2024 02:55:09 +0200 Subject: [PATCH] "explicit template specialization cannot have a storage class" fix --- src/cppscript_bindings.h | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/cppscript_bindings.h b/src/cppscript_bindings.h index 63f356b..fa35651 100644 --- a/src/cppscript_bindings.h +++ b/src/cppscript_bindings.h @@ -25,37 +25,34 @@ struct is_supported_type { // MSVC needs this for no reason template struct is_supported_type> { - static constexpr bool value = is_defined>::value; + static constexpr bool value = true; }; -// - -template -static constexpr bool is_supported_type_v = is_supported_type::value; -// And this template<> -static constexpr bool is_supported_type_v = true; +struct is_supported_type { + static constexpr bool value = true; +}; template<> -static constexpr bool is_supported_type_v = true; +struct is_supported_type { + static constexpr bool value = true; +}; template<> -static constexpr bool is_supported_type_v = true; +struct is_supported_type { + static constexpr bool value = true; +}; // template struct assert_is_supported_type { - static constexpr bool value = is_supported_type_v; - static_assert(is_supported_type_v, "Type not supported. If it's your custom class, either it had complilation errors, or maybe you forgot to register it with GCLASS()"); + static constexpr bool value = is_supported_type::value; + static_assert(is_supported_type::value, "Type not supported. If it's your custom class, either it had complilation errors, or maybe you forgot to register it with GCLASS()"); }; -template -static constexpr bool assert_is_supported_type_v = assert_is_supported_type::value; - - template struct assert_is_ret_supported { - static constexpr bool value = assert_is_supported_type_v; + static constexpr bool value = assert_is_supported_type::value; }; template<> struct assert_is_ret_supported { @@ -67,12 +64,12 @@ struct MemberSignature; template struct MemberSignature { - static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type_v && ...); + static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type::value && ...); }; template struct MemberSignature { - static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type_v && ...); + static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type::value && ...); }; template @@ -80,7 +77,7 @@ struct FunctionSignature; template struct FunctionSignature { - static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type_v && ...); + static constexpr bool value = assert_is_ret_supported::value && (assert_is_supported_type::value && ...); }; @@ -172,13 +169,13 @@ _FORCE_INLINE_ void destroy_object(T& obj) { template _FORCE_INLINE_ godot::PropertyInfo MakePropertyInfo(Args&&... args) { - static_assert(impl::assert_is_supported_type_v, "Property of this type is not supported"); + static_assert(impl::assert_is_supported_type::value, "Property of this type is not supported"); using IsResource = impl::IsResourceProperty; if constexpr(sizeof...(Args) == 1 && IsResource::value) { - return impl::BindCheck>::template MakePropertyInfo(std::forward(args)..., godot::PROPERTY_HINT_RESOURCE_TYPE, IsResource::type::get_class_static()); + return impl::BindCheck::value>::template MakePropertyInfo(std::forward(args)..., godot::PROPERTY_HINT_RESOURCE_TYPE, IsResource::type::get_class_static()); } else { - return impl::BindCheck>::template MakePropertyInfo(std::forward(args)...); + return impl::BindCheck::value>::template MakePropertyInfo(std::forward(args)...); } }