[PATCH] PR libstdc++/86751 default assignment operators for std::pair

Jonathan Wakely jwakely@redhat.com
Tue Jul 31 22:34:00 GMT 2018


On 31/07/18 18:40 +0100, Jonathan Wakely wrote:
>On 31/07/18 20:14 +0300, Ville Voutilainen wrote:
>>On 31 July 2018 at 20:07, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>The solution for PR 77537 causes ambiguities due to the extra copy
>>>assignment operator taking a __nonesuch_no_braces parameter. The copy
>>>and move assignment operators can be defined as defaulted to meet the
>>>semantics required by the standard.
>>>
>>>In order to preserve ABI compatibility (specifically argument passing
>>>conventions for pair<T, T>) we need a new base class that makes the
>>>assignment operators non-trivial.
>>>
>>>        PR libstdc++/86751
>>>        * include/bits/stl_pair.h (__nonesuch_no_braces): Remove.
>>>        (__pair_base): New class with non-trivial copy assignment operator.
>>>        (pair): Derive from __pair_base. Define copy assignment and move
>>>        assignment operators as defaulted.
>>>        * testsuite/20_util/pair/86751.cc: New test.
>>>
>>>
>>>Ville, this passes all our tests, but am I forgetting something that
>>>means this isn't right?
>>
>>Pairs of references?
>
>I knew there was a reason.
>
>We need better tests, since nothing failed when I made this change.
>
>OK, let me rework the patch ...

Here's the patch I've committed. It adds a test for pairs of
references, so I don't try to define t he assignment ops as defaulted
again :-)  Thanks for the quick feedback for these patches.

Tested powerpc64le-linux, committed to trunk.

This is a regression on all branches, but I'd like to leave it on
trunk for a short while before backporting it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 8047 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180731/378ea130/attachment.bin>


More information about the Libstdc++ mailing list