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

Jonathan Wakely jwakely@redhat.com
Tue Jul 31 17:40:00 GMT 2018


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 ...




More information about the Libstdc++ mailing list