This is the mail archive of the
mailing list for the GCC project.
Re: Fix std::pair std::is_copy_assignable behavior
- From: François Dumont <frs dot dumont at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 17 Apr 2013 22:22:54 +0200
- Subject: Re: Fix std::pair std::is_copy_assignable behavior
- References: <51687815 dot 6030507 at gmail dot com> <516EF3B1 dot 2050401 at gmail dot com> <516EF57A dot 9030607 at oracle dot com> <516EFB59 dot 10105 at gmail dot com> <516EFFC7 dot 6070001 at oracle dot com>
On 04/17/2013 10:02 PM, Paolo Carlini wrote:
On 4/17/13 8:43 PM, François Dumont wrote:
I'm not talking about GCC's Bugzilla, I meant an ISO DR: if we don't
have a DR and preferably a vague support of LWG people, I think we
should not change the behavior of our std::is_copy_assignable only
because it helps our implementation of other facilities.
On 04/17/2013 09:18 PM, Paolo Carlini wrote:
The behavior I am targeting is
std::is_copy_asignable<std::pair<const int, int>> to be
std::false_type for instance. I have added test for many other use
cases. More generally I need that when std::is_copy_assignable<T> is
std::true_type then writing a = b, with a and b being T, does compile.
On 4/17/13 8:10 PM, François Dumont wrote:
Sorry, I'm still missing something very, very basic: which behavior
is conforming, the current one or what we would get instead? If the
former, is there a DR arguing for the latter?
Here is an other proposal to fix
Otherwise this patch just make std::pair match the Standard
requirements like at 184.108.40.206. Do you want me to add a bug report in
Bugzilla first ?
I really don't get it. Is current behavior really Standard compliant ?
I don't think so and would like to fix it. The Standard says that
pair& operator=(const pair&) requires that both
is_copy_assignable<first_type> and is_copy_assignable<second_type> to be
true. With std::pair<const int, int>, is_copy_assignable<const int> is
false and then the operator is ill formed. It is if you try to call it
but if you check is_copy_assignable<pair<const int, int>> it says true.
Do you see it as a correct behavior ? Do you really think that it
requires an ISO DR ?