[gcc r14-1995] libstdc++: Remove redundant code in std::to_array
Jonathan Wakely
redi@gcc.gnu.org
Tue Jun 20 14:36:25 GMT 2023
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
More information about the Libstdc++-cvs
mailing list