[PATCH] PR libstdc++/87704 fix unique_ptr(nullptr_t) constructors
Jonathan Wakely
jwakely@redhat.com
Thu Oct 25 16:16:00 GMT 2018
On 23/10/18 14:10 +0100, Jonathan Wakely wrote:
>Using a delegating constructor to implement these constructors means
>that they instantiate the destructor, which requires the element_type to
>be complete. In C++11 and C++14 they were specified to be delegating,
>but that was changed as part of LWG 2801 so in C++17 they don't require
>a complete type (as was intended all along).
>
> PR libstdc++/87704
> * include/bits/unique_ptr.h (unique_ptr::unique_ptr(nullptr_t)): Do
> not delegate to default constructor.
> (unique_ptr<T[], D>::unique_ptr(nullptr_t)): Likewise.
> * testsuite/20_util/unique_ptr/cons/incomplete.cc: New test.
>
>Tested powerpc64le-linux, committed to trunk. Backports to follow.
This is the backport for gcc-6-branch. It's slightly different,
because on that branch we make null deleters ill-formed via
static_assert, instead of disabling the constructor via SFINAE. If
the unique_ptr(nullptr_t) constructors don't delegate to the default
constructor they need to duplicate the assertion from the default
constructor.
Tested x86_64-linux.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 5094 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181025/6d1397a4/attachment.bin>
More information about the Libstdc++
mailing list