From ce44c5954734cd8effb62affab8dcc265d4baf39 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 18 Oct 2021 11:27:22 +0200 Subject: [PATCH] meta: suppress warnings due to unreachable code --- src/entt/meta/utility.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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