]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/86751 default assignment operators for std::pair
authorJonathan Wakely <jwakely@redhat.com>
Mon, 15 Oct 2018 11:52:48 +0000 (12:52 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 15 Oct 2018 11:52:48 +0000 (12:52 +0100)
commit92eeabf115c7b12f2f15bd17fd167f99206e95fe
tree01e7906c416fb89c82db962d4df9d82970be07d5
parentc35f091830307a2fe78a3d533142bda937b180a7
PR libstdc++/86751 default assignment operators for std::pair

The solution for PR 77537 causes ambiguities due to the extra copy
assignment operator taking a __nonesuch_no_braces parameter. By making
the base class non-assignable we don't need the extra deleted overload
in std::pair. The copy assignment operator will be implicitly deleted
(and the move assignment operator not declared) as needed. Without the
additional user-provided operator in std::pair the ambiguity is avoided.

Backport from mainline
2018-07-31  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/86751
* include/bits/stl_pair.h (__pair_base): New class with deleted copy
assignment operator.
(pair): Derive from __pair_base.
(pair::operator=): Remove deleted overload.
* python/libstdcxx/v6/printers.py (StdPairPrinter): New pretty printer
so that new base class isn't shown in GDB.
* testsuite/20_util/pair/86751.cc: New test.
* testsuite/20_util/pair/ref_assign.cc: New test.

From-SVN: r265162
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/20_util/pair/86751.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/pair/ref_assign.cc [new file with mode: 0644]