public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-1995] libstdc++: Remove redundant code in std::to_array
Date: Tue, 20 Jun 2023 14:36:25 +0000 (GMT)	[thread overview]
Message-ID: <20230620143625.2EBD83858D1E@sourceware.org> (raw)

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

                 reply	other threads:[~2023-06-20 14:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230620143625.2EBD83858D1E@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).