Fwd: Fix std::pair std::is_copy_assignable behavior

François Dumont frs.dumont@gmail.com
Sat Apr 13 19:21:00 GMT 2013


     Here is a patch already posted to libstdc++ mailing but I am 
resending following libstdc++ maintainers advises to add gcc-patches 
mailing list.

     This patch proposal is to fix the behavior of std::pair regarding 
the std::is_*_assignable meta programming functions.

     As announced it is requiring a compiler patch to extend DR 1402 
resolution to all defaulted methods.

2013-04-12 François Dumont <fdumont@gcc.gnu.org>

     * call.c (joust): Extend DR 1402 to all defaulted methods.

     This modification is mandatory so that pair& operator=(const pair&) 
can be defaulted whereas leaving gcc consider the other operator= in 
some situations like std::pair<int&, int>. This way, with usage of 
std::enable_if on the template operator=, we can control when p1= p2 is 
a valid expression resulting in a correct behavior of 

     For the moment I preferred to add a dg-require-normal-mode option 
in the single test that fail to compile because of the compiler 

Does DR 1402 resolution generalization need a Standard committee 
validation first ?

2013-04-13  François Dumont  <fdumont@gcc.gnu.org>

     * include/bits/stl_pair.h (operator=(const pair&)): Defaulted.
     (operator=(pair&&)): Likewise.
     (template<> operator=(const pair&)): Add noexcept
     qualification. Enable if is_assignable<T&, const U&> true for both
     (template<> operator=(pair<>&&)): Add noexcept
     qualification. Enable if is_assignable<T&, U&&> true for both
     * testsuite/23_containers/unordered_set/55043.cc: Add
     * testsuite/20_util/pair/is_move_assignable.cc: New.
     * testsuite/20_util/pair/is_copy_assignable.cc: Likewise.
     * testsuite/20_util/pair/is_assignable.cc: Likewise.
     * testsuite/20_util/pair/is_nothrow_move_assignable.cc: Likewise.
     * testsuite/20_util/pair/assign_neg.cc: Likewise.
     * testsuite/20_util/pair/is_nothrow_copy_assignable.cc: Likewise.
     * testsuite/20_util/pair/assign.cc: Likewise.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: call.c.patch
Type: text/x-patch
Size: 1460 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130413/b9f88497/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pair.patch
Type: text/x-patch
Size: 19879 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130413/b9f88497/attachment-0001.bin>

More information about the Libstdc++ mailing list