This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] PR libstdc++/86751 default assignment operators for std::pair
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 31 Jul 2018 18:40:39 +0100
- Subject: Re: [PATCH] PR libstdc++/86751 default assignment operators for std::pair
- References: <20180731170737.GA23260@redhat.com> <CAFk2RUaW32pww1d0rRZ=f0rYWDTuLyoiwDDGCa71HseZVHt+WA@mail.gmail.com>
On 31/07/18 20:14 +0300, Ville Voutilainen wrote:
On 31 July 2018 at 20:07, Jonathan Wakely <email@example.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.
* 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 ...