diff --git a/src/entt/meta/factory.hpp b/src/entt/meta/factory.hpp index 4a44eefd2..e89d4b0df 100644 --- a/src/entt/meta/factory.hpp +++ b/src/entt/meta/factory.hpp @@ -236,7 +236,7 @@ public: */ template auto base() ENTT_NOEXCEPT { - static_assert(std::is_base_of_v, "Invalid base type"); + static_assert(!std::is_same_v && std::is_base_of_v, "Invalid base type"); static internal::meta_base_node node{ nullptr, @@ -269,9 +269,12 @@ public: */ template auto conv() ENTT_NOEXCEPT { + using conv_type = std::remove_const_t>>; + static_assert(!std::is_same_v && std::is_convertible_v, "Could not convert to the required type"); + static internal::meta_conv_node node{ nullptr, - internal::meta_node>>>::resolve(), + internal::meta_node::resolve(), [](const meta_any &instance) -> meta_any { return forward_as_meta(std::invoke(Candidate, *static_cast(instance.data()))); } @@ -293,11 +296,12 @@ public: */ template auto conv() ENTT_NOEXCEPT { - static_assert(std::is_convertible_v, "Could not convert to the required type"); + using conv_type = std::remove_const_t>; + static_assert(!std::is_same_v && std::is_convertible_v, "Could not convert to the required type"); static internal::meta_conv_node node{ nullptr, - internal::meta_node>>::resolve(), + internal::meta_node::resolve(), [](const meta_any &instance) -> meta_any { return forward_as_meta(static_cast(*static_cast(instance.data()))); } // tricks clang-format }; @@ -323,7 +327,7 @@ public: auto ctor() ENTT_NOEXCEPT { using descriptor = meta_function_helper_t; static_assert(Policy::template value, "Invalid return type for the given policy"); - static_assert(std::is_same_v, Type>, "The function doesn't return an object of the required type"); + static_assert(std::is_same_v>, Type>, "The function doesn't return an object of the required type"); static internal::meta_ctor_node node{ nullptr,