Michele Caini 1 год назад
Родитель
Сommit
1eaff4f3d9
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/entt/core/any.hpp

+ 3 - 3
src/entt/core/any.hpp

@@ -83,7 +83,7 @@ class basic_any {
             break;
             break;
         case request::compare:
         case request::compare:
             if constexpr(!std::is_function_v<Type> && !std::is_array_v<Type> && is_equality_comparable_v<Type>) {
             if constexpr(!std::is_function_v<Type> && !std::is_array_v<Type> && is_equality_comparable_v<Type>) {
-                return *elem == *static_cast<const Type *>(other) ? other : nullptr;
+                return (*elem == *static_cast<const Type *>(other)) ? other : nullptr;
             } else {
             } else {
                 return (elem == other) ? other : nullptr;
                 return (elem == other) ? other : nullptr;
             }
             }
@@ -97,13 +97,13 @@ class basic_any {
             ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy");
             ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy");
             if constexpr(in_situ<Type>) {
             if constexpr(in_situ<Type>) {
                 // NOLINTNEXTLINE(bugprone-casting-through-void)
                 // NOLINTNEXTLINE(bugprone-casting-through-void)
-                return ::new(&static_cast<basic_any *>(const_cast<void *>(other))->storage) Type{std::move(*const_cast<Type *>(elem))};
+                return static_cast<const void *>(::new(&static_cast<basic_any *>(const_cast<void *>(other))->storage) Type{std::move(*const_cast<Type *>(elem))});
             }
             }
             [[fallthrough]];
             [[fallthrough]];
         case request::get:
         case request::get:
             ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy");
             ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy");
             if constexpr(in_situ<Type>) {
             if constexpr(in_situ<Type>) {
-                return elem;
+                return static_cast<const void *>(elem);
             }
             }
         }
         }