Implement LWG 2905 changes to constrain unique_ptr constructors
authorJonathan Wakely <jwakely@redhat.com>
Tue, 11 Sep 2018 10:55:49 +0000 (11:55 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 11 Sep 2018 10:55:49 +0000 (11:55 +0100)
commit86fc6ec9f366fd95d976c01bfa24c6775537ba62
treece28f3d56213828fb0d7b4202d9c1940bcb5feab
parent9356a18eb4aa927c9e44245075b82fa0c6001789
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.

From-SVN: r264206
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