Просмотр исходного кода

any: no args to new[] (fair enough)

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

+ 2 - 1
src/entt/core/any.hpp

@@ -134,7 +134,8 @@ class basic_any {
                 if constexpr(std::is_aggregate_v<plain_type> && (sizeof...(Args) != 0u || !std::is_default_constructible_v<plain_type>)) {
                     instance = new plain_type{std::forward<Args>(args)...};
                 } else if constexpr(std::is_array_v<plain_type>) {
-                    instance = new plain_type[std::extent_v<plain_type>](std::forward<Args>(args)...);
+                    static_assert(sizeof...(Args) == 0u);
+                    instance = new plain_type[std::extent_v<plain_type>]();
                 } else {
                     instance = new plain_type(std::forward<Args>(args)...);
                 }