Fix location of invocable check for unique_ptr deleter
commitcee838d92d032f4e45050f66bfaea11f38c8455f
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Sep 2018 16:05:36 +0000 (18 16:05 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Sep 2018 16:05:36 +0000 (18 16:05 +0000)
tree972c09ab072dd40014d9173255ca43195237a020
parent9c66b1e3a61119eb7cb762ff72c40e7309c16d55
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264399 138bc75d-0d04-0410-961f-82ee72b054a4
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]