Fix location of invocable check for unique_ptr deleter
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Sep 2018 16:05:36 +0000 (17:05 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 18 Sep 2018 16:05:36 +0000 (17:05 +0100)
commita12c16de529755cdf4dbc594dd48742107ad349e
tree972c09ab072dd40014d9173255ca43195237a020
parentf96c8666f57e89182c3b0661f2e5e19f8b70aa8a
Fix location of invocable check for unique_ptr deleter

The deleter only needs to be invocable when the unique_ptr destructor
and reset member function are instantiated. In other contexts it might
not be possible to pass unique_ptr<T, D>::pointer to the deleter, if
that requires a derived-to-base conversion from T* and T is incomplete.

* include/bits/unique_ptr.h (__uniq_ptr_impl): Remove static assertion
checking invocable condition.
(unique_ptr::~unique_ptr, unique_ptr::reset): Restore static assertion
here, where types must be complete. Pass pointer to deleter as an
rvalue.
* testsuite/20_util/unique_ptr/requirements/incomplete.cc: New test.

From-SVN: r264399
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/unique_ptr/requirements/incomplete.cc [new file with mode: 0644]