diff --git a/src/entt/meta/utility.hpp b/src/entt/meta/utility.hpp index 62fbd1d93..fefefd216 100644 --- a/src/entt/meta/utility.hpp +++ b/src/entt/meta/utility.hpp @@ -305,22 +305,26 @@ templatetry_cast(); clazz && ((args + Index)->allow_cast>() && ...)) { return meta_invoke_with_args(std::forward(candidate), *clazz, (args + Index)->cast>()...); } + + return meta_any{}; } else if constexpr(std::is_invocable_v, Type &, type_list_element_t...>) { if(auto *const clazz = instance->try_cast(); clazz && ((args + Index)->allow_cast>() && ...)) { return meta_invoke_with_args(std::forward(candidate), *clazz, (args + Index)->cast>()...); } + + return meta_any{}; } else if constexpr(sizeof...(Index) != 0u) { if(((args + Index)->allow_cast>() && ...)) { return meta_invoke_with_args(std::forward(candidate), (args + Index)->cast>()...); } + + return meta_any{}; } else if constexpr(std::is_void_v(candidate)())>) { std::forward(candidate)(); return meta_any{std::in_place_type}; } else { return meta_dispatch(std::forward(candidate)()); } - - return meta_any{}; } template