]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Remove redundant code in std::to_array
authorJonathan Wakely <jwakely@redhat.com>
Tue, 20 Jun 2023 08:27:04 +0000 (09:27 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 20 Jun 2023 14:35:48 +0000 (15:35 +0100)
libstdc++-v3/ChangeLog:

* include/std/array (to_array(T(&)[N])): Remove redundant
condition.
(to_array(T(&&)[N])): Remove redundant std::move.

libstdc++-v3/include/std/array

index b791d86ddb24a162565345d908b0dad6e081fff4..ad36cdad6d21839794aca1d8d8a373c36c2171a4 100644 (file)
@@ -426,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       static_assert(is_constructible_v<_Tp, _Tp&>);
       if constexpr (is_constructible_v<_Tp, _Tp&>)
        {
-         if constexpr (is_trivial_v<_Tp> && _Nm != 0)
+         if constexpr (is_trivial_v<_Tp>)
            {
              array<remove_cv_t<_Tp>, _Nm> __arr;
              if (!__is_constant_evaluated() && _Nm != 0)
@@ -462,7 +462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                __builtin_memcpy(__arr.data(), __a, sizeof(__a));
              else
                for (size_t __i = 0; __i < _Nm; ++__i)
-                 __arr._M_elems[__i] = std::move(__a[__i]);
+                 __arr._M_elems[__i] = __a[__i];
              return __arr;
            }
          else