This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/77987] unique_ptr<T[]> reset rejects cv-compatible pointers
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Oct 2016 12:01:16 +0000
- Subject: [Bug libstdc++/77987] unique_ptr<T[]> reset rejects cv-compatible pointers
- Auto-submitted: auto-generated
- References: <bug-77987-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77987
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Oct 17 12:00:44 2016
New Revision: 241235
URL: https://gcc.gnu.org/viewcvs?rev=241235&root=gcc&view=rev
Log:
PR77987 Fix unique_ptr<T[], D>::reset(U) for T != U
PR libstdc++/77987
* include/bits/unique_ptr.h (unique_ptr<T[], D>::reset<U>(U)): Copy
value to pointer of the correct type to swap, to support conversions
allowed by LWG 2118 / N4089.
* testsuite/20_util/unique_ptr/assign/assign_neg.cc: Move test for
incompatible deleters from ...
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: ... here.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Move tests for
incompatible pointers to ...
* testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: ... here. Move
destructor definition to base class. Test for invalid derived-to-base
conversion.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/unique_ptr.h
trunk/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
trunk/libstdc++-v3/testsuite/20_util/unique_ptr/assign/cv_qual.cc
trunk/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/cv_qual.cc
trunk/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc