[Bug libstdc++/93562] [8/9 Regression] unique_ptr::swap incorrectly uses generic std::swap

2020-02-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93562

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jonathan Wakely  ---
Fixed for 8.4 and 9.3 as well.

[Bug libstdc++/93562] [8/9 Regression] unique_ptr::swap incorrectly uses generic std::swap

2020-02-26 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93562

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jonathan Wakely  ---
Fixed for 8.4 and 9.3 as well.

--- Comment #7 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:e47c9cd77f5e60780f054aacb096315b1fcca8bb

commit r8-10088-ge47c9cd77f5e60780f054aacb096315b1fcca8bb
Author: Jonathan Wakely 
Date:   Wed Feb 26 15:04:53 2020 +

libstdc++: Fix regressions in unique_ptr::swap (PR 93562)

The requirements for this function are only that the deleter is
swappable, but we incorrectly require that the element type is complete
and that the deleter can be swapped using std::swap (which requires it
to be move cosntructible and move assignable).

The fix is to add __uniq_ptr_impl::swap which swaps the pointer and
deleter individually, instead of using the generic std::swap on the
tuple containing them.

PR libstdc++/93562
* include/bits/unique_ptr.h (__uniq_ptr_impl::swap): Define.
(unique_ptr::swap, unique_ptr::swap): Call it.
* testsuite/20_util/unique_ptr/modifiers/93562.cc: New test.

[Bug libstdc++/93562] [8/9 Regression] unique_ptr::swap incorrectly uses generic std::swap

2020-02-26 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93562

--- Comment #5 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:30cb4c78ea6563177c43f897e480d9993c38c0ed

commit r9-8285-g30cb4c78ea6563177c43f897e480d9993c38c0ed
Author: Jonathan Wakely 
Date:   Wed Feb 26 15:04:53 2020 +

libstdc++: Fix regressions in unique_ptr::swap (PR 93562)

The requirements for this function are only that the deleter is
swappable, but we incorrectly require that the element type is complete
and that the deleter can be swapped using std::swap (which requires it
to be move cosntructible and move assignable).

The fix is to add __uniq_ptr_impl::swap which swaps the pointer and
deleter individually, instead of using the generic std::swap on the
tuple containing them.

PR libstdc++/93562
* include/bits/unique_ptr.h (__uniq_ptr_impl::swap): Define.
(unique_ptr::swap, unique_ptr::swap): Call it.
* testsuite/20_util/unique_ptr/modifiers/93562.cc: New test.

[Bug libstdc++/93562] [8/9 Regression] unique_ptr::swap incorrectly uses generic std::swap

2020-02-04 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93562

Jonathan Wakely  changed:

   What|Removed |Added

Summary|[8/9/10 Regression] |[8/9 Regression]
   |unique_ptr::swap|unique_ptr::swap
   |incorrectly uses generic|incorrectly uses generic
   |std::swap   |std::swap

--- Comment #4 from Jonathan Wakely  ---
Fixed in master for now, backports to follow.