[Bug libstdc++/87704] [6/7/8/9 Regression] unique_ptr<T>(nullptr_t) requires T to be complete

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 23 15:29:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87704

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Oct 23 15:29:03 2018
New Revision: 265428

URL: https://gcc.gnu.org/viewcvs?rev=265428&root=gcc&view=rev
Log:
PR libstdc++/87704 fix unique_ptr(nullptr_t) constructors

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.

Added:
   
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/unique_ptr/cons/incomplete.cc
Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/bits/unique_ptr.h


More information about the Gcc-bugs mailing list