diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index 6c328ea50..0cd5d48b5 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -83,7 +83,7 @@ class basic_any { break; case request::compare: if constexpr(!std::is_function_v && !std::is_array_v && is_equality_comparable_v) { - return *elem == *static_cast(other) ? other : nullptr; + return (*elem == *static_cast(other)) ? other : nullptr; } else { return (elem == other) ? other : nullptr; } @@ -97,13 +97,13 @@ class basic_any { ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy"); if constexpr(in_situ) { // NOLINTNEXTLINE(bugprone-casting-through-void) - return ::new(&static_cast(const_cast(other))->storage) Type{std::move(*const_cast(elem))}; + return static_cast(::new(&static_cast(const_cast(other))->storage) Type{std::move(*const_cast(elem))}); } [[fallthrough]]; case request::get: ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy"); if constexpr(in_situ) { - return elem; + return static_cast(elem); } }