Implement LWG 2905 changes to constrain unique_ptr constructors
commit199f729ee3a6bd564151cda4caac289fbe7105cc
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Sep 2018 10:55:49 +0000 (11 10:55 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Sep 2018 10:55:49 +0000 (11 10:55 +0000)
treece28f3d56213828fb0d7b4202d9c1940bcb5feab
parent9af74114e1ec1c93d7ce6da3fc2115433e15035c
Implement LWG 2905 changes to constrain unique_ptr constructors

LWG DR 2905 says that is_constructible_v<unique_ptr<P, D>, P, D const &>
should be false when D is not copy constructible. This commit implements
the changes from the DR and simplifies the signatures as per
https://github.com/cplusplus/draft/issues/1530

* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
check deleter type.
(unique_ptr::unique_ptr(pointer, const deleter_type&)): Add copy
constructible constraint.
(unique_ptr::unique_ptr(pointer, deleter_type&&)): Disable for
deleters of reference type and add move constructible constraint.
(unique_ptr::unique_ptr(pointer, remove_reference_t<deleter_type>&&)):
Disable for deleters of non-reference type. Define as deleted.
(unique_ptr<T[], D>): Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
directives with unstable line numbers with dg-prune-output.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/lwg2905.cc: New test.
* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
Make deleter types invocable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264206 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/cons/lwg2905.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc