public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1995] libstdc++: Remove redundant code in std::to_array
@ 2023-06-20 14:36 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-06-20 14:36 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:b4f1e4a644380282f1e873f9ab2ebb2941ca34ce

commit r14-1995-gb4f1e4a644380282f1e873f9ab2ebb2941ca34ce
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jun 20 09:27:04 2023 +0100

    libstdc++: Remove redundant code in std::to_array
    
    libstdc++-v3/ChangeLog:
    
            * include/std/array (to_array(T(&)[N])): Remove redundant
            condition.
            (to_array(T(&&)[N])): Remove redundant std::move.

Diff:
---
 libstdc++-v3/include/std/array | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index b791d86ddb2..ad36cdad6d2 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-20 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 14:36 [gcc r14-1995] libstdc++: Remove redundant code in std::to_array Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).