[PATCH] PR77987 Fix unique_ptr<T[], D>::reset(U) for T != U
Jonathan Wakely
jwakely@redhat.com
Wed Oct 19 10:11:00 GMT 2016
On 17/10/16 13:00 +0100, Jonathan Wakely wrote:
>This is a very simple change, to allow conversions that are supposed
>to be valid according to DR 2118. The fix was slightly complicated by
>the tests being a bit of a mess. We had tests for this requirement,
>but they were in files which mixed positive tests and negative tests.
>I've split the tests so the invalid operations are in separate files
>and all the valid operations are in files that should pass.
>
> 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.
>
>I'll also backport this to the branches.
Here's another case where we have positive and negative tests in the
same file. I'm splitting this one too, and fixing one of the tests to
match its comment.
Tested powerpc64le-linux, comitted to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 4455 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20161019/fd79dd3a/attachment.bin>
More information about the Libstdc++
mailing list