[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-10-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |11.3

--- Comment #9 from Jonathan Wakely  ---
Fixed for 11.3

Given that nobody noticed this before now, I don't think backporting it further
is necessary. Thanks for the report.

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-10-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #8 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

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

commit r11-9121-ge748216c237cff2915390e9653de2db63b2161ac
Author: Jonathan Wakely 
Date:   Tue Oct 12 15:09:50 2021 +0100

libstdc++: Fix move construction of std::tuple with array elements
[PR101960]

The r12-3022 commit only fixed the case where an array is the last
element of the tuple. This fixes the other cases too. We can just define
the move constructor as defaulted, which does the right thing. Changing
the move constructor to be trivial would be an ABI break, but since the
last base class still has a non-trivial move constructor, defining the
derived ones as defaulted doesn't change anything.

libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as
defauled.
* testsuite/20_util/tuple/cons/101960.cc: Check tuples with
array elements before the last element.

(cherry picked from commit 7481021364e75ba583972e15ed421a53988368ea)

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-10-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:7481021364e75ba583972e15ed421a53988368ea

commit r12-4356-g7481021364e75ba583972e15ed421a53988368ea
Author: Jonathan Wakely 
Date:   Tue Oct 12 15:09:50 2021 +0100

libstdc++: Fix move construction of std::tuple with array elements
[PR101960]

The r12-3022 commit only fixed the case where an array is the last
element of the tuple. This fixes the other cases too. We can just define
the move constructor as defaulted, which does the right thing. Changing
the move constructor to be trivial would be an ABI break, but since the
last base class still has a non-trivial move constructor, defining the
derived ones as defaulted doesn't change anything.

libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as
defauled.
* testsuite/20_util/tuple/cons/101960.cc: Check tuples with
array elements before the last element.

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-10-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:00967465fe8093661a4d42356821eeb04170e09d

commit r11-9116-g00967465fe8093661a4d42356821eeb04170e09d
Author: Jonathan Wakely 
Date:   Thu Aug 19 11:48:40 2021 +0100

libstdc++: Fix move construction of std::tuple with array elements
[PR101960]

An array member cannot be direct-initialized in a ctor-initializer-list,
so use the base class' move constructor, which does the right thing for
both arrays and non-arrays.

This constructor could be defaulted, but that would make it trivial for
some specializations, which would change the argument passing ABI. Do
that for the versioned namespace only.

Signed-off-by: Jonathan Wakely 

libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Use base
class' move constructor. Define as defaulted for versioned
namespace.
* testsuite/20_util/tuple/cons/101960.cc: New test.

(cherry picked from commit 0187e0d7360f327f88d8b2294668669306ae4630)

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-09-03 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

康桓瑋  changed:

   What|Removed |Added

 CC||hewillk at gmail dot com

--- Comment #5 from 康桓瑋  ---
(In reply to Jonathan Wakely from comment #4)
> Fixed on trunk, but I plan to backport it.

You neglected the recursive one.

#include 

std::tuple t;
auto t2 = std::move(t);

https://godbolt.org/z/b4jrs1fYb

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-08-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #4 from Jonathan Wakely  ---
Fixed on trunk, but I plan to backport it.

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-08-19 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:0187e0d7360f327f88d8b2294668669306ae4630

commit r12-3022-g0187e0d7360f327f88d8b2294668669306ae4630
Author: Jonathan Wakely 
Date:   Thu Aug 19 11:48:40 2021 +0100

libstdc++: Fix move construction of std::tuple with array elements
[PR101960]

An array member cannot be direct-initialized in a ctor-initializer-list,
so use the base class' move constructor, which does the right thing for
both arrays and non-arrays.

This constructor could be defaulted, but that would make it trivial for
some specializations, which would change the argument passing ABI. Do
that for the versioned namespace only.

Signed-off-by: Jonathan Wakely 

libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Use base
class' move constructor. Define as defaulted for versioned
namespace.
* testsuite/20_util/tuple/cons/101960.cc: New test.

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-08-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

--- Comment #2 from Jonathan Wakely  ---
N.B. simply defining it as defaulted would make it trivial for some
specializations, which might be an ABI break.

[Bug libstdc++/101960] std::tuple with an array element is rejected as a named return type

2021-08-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101960

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2021-08-18
   Keywords||rejects-valid
 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Jonathan Wakely  ---
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -441,7 +441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   constexpr
   _Tuple_impl(_Tuple_impl&& __in)
   noexcept(is_nothrow_move_constructible<_Head>::value)
-  : _Base(std::forward<_Head>(_M_head(__in)))
+  : _Base(std::forward<_Base>(__in))
   { }

   template