[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-20 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

--- Comment #5 from Jonathan Wakely  ---
Author: redi
Date: Mon Aug 20 13:53:56 2018
New Revision: 263661

URL: https://gcc.gnu.org/viewcvs?rev=263661=gcc=rev
Log:
PR libstdc++/86963 Remove use of __tuple_base in std::tuple

The _Tuple_impl base class can be used to disable copy/move assignment,
without requiring an extra base class.

Exception specifications on std::tuple assignment and swap functions can
be defined directly using is_nothrow_swappable, instead of querying the
base classes.

PR libstdc++/86963
* include/std/tuple (_Tuple_impl::operator=): Define as deleted.
(_Tuple_impl::_M_assign): New functions to perform assignment instead
of assignment operators.
(_Tuple_impl::_M_swap): Remove exception specification.
(_Tuple_impl<_Idx, _Head>): Likewise.
(_TC::_NonNestedTuple, _TC::_NotSameTuple): Use __remove_cvref_t.
(__tuple_base): Remove.
(tuple, tuple<_T1, _T2>): Remove inheritance from __tuple_base.
(tuple::operator=, tuple<_T1, _T2>::operator=): Call _M_assign.
(tuple::swap, tuple<_T1, _T2>::swap): Define exception specification
using __is_nothrow_swappable.
(tuple<_T1, _T2>::tuple(_U1&&, _U2&&)): Use __remove_cvref_t.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/tuple

[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

Jonathan Wakely  changed:

   What|Removed |Added

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

--- Comment #4 from Jonathan Wakely  ---
Fixed for GCC 9.

[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

--- Comment #3 from Jonathan Wakely  ---
Author: redi
Date: Fri Aug 17 17:52:49 2018
New Revision: 263625

URL: https://gcc.gnu.org/viewcvs?rev=263625=gcc=rev
Log:
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment

PR libstdc++/86963
* include/std/tuple (__tuple_base): New class template with deleted
copy assignment operator.
(tuple, tuple<_T1, _T2>): Derive from __tuple_base so that
implicit copy/move assignment operator will be deleted/suppressed.
(tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper
functions for SFINAE constraints on assignment operators.
(tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable):
New helper functions for exception specifications.
(tuple::operator=(const tuple&), tuple::operator=(tuple&&))
(tuple<_T1, _T2>::operator=(const tuple&))
(tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to
__nonesuch_no_braces when the operator should be defined implicitly.
Use __nothrow_assignable for exception specifications.
(tuple::operator=(const tuple<_UElements...>&))
(tuple::operator=(tuple<_UElements...>&&))
(tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&))
(tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&))
(tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&))
(tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using
__assignable and use __nothrow_assignable for exception
specifications.
* python/libstdcxx/v6/printers.py (is_specialization_of): Accept
gdb.Type as first argument, instead of a string.
(StdTuplePrinter._iterator._is_nonempty_tuple): New method to check
tuple for expected structure.
(StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple.
* testsuite/20_util/tuple/dr2729.cc: New test.
* testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error
to dg-prune-output.

Added:
trunk/libstdc++-v3/testsuite/20_util/tuple/dr2729.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/tuple
trunk/libstdc++-v3/python/libstdcxx/v6/printers.py
trunk/libstdc++-v3/testsuite/20_util/tuple/element_access/get_neg.cc

[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org

[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-15 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

--- Comment #2 from Jonathan Wakely  ---
I think we want a similar solution as for PR 86751 i.e. r263185

[Bug libstdc++/86963] std::tuple incorrectly assigned

2018-08-15 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-15
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
This is a new requirement in C++17, since https://wg21.link/lwg2729

Previous standards did not require the assignment to be deleted or removed from
overload resolution.