Implement N4089 Safe conversions in unique_ptr<T[]> (LWG 2118) and N4366 LWG 2228...
authorVille Voutilainen <ville.voutilainen@gmail.com>
Sat, 8 Aug 2015 11:07:34 +0000 (14:07 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Sat, 8 Aug 2015 11:07:34 +0000 (14:07 +0300)
commitf3344569038591116cc3b5d775443a576d1b7f96
tree97230bb560a8b0cb2868d38cf3d214654664119c
parent0d251765bed679b14b4f9f2d5ade7870b7b9d7c5
Implement N4089 Safe conversions in unique_ptr<T[]> (LWG 2118) and N4366 LWG 2228...

2015-08-08  Ville Voutilainen  <ville.voutilainen@gmail.com>

Implement N4089 Safe conversions in unique_ptr<T[]> (LWG 2118)
and N4366 LWG 2228: Missing SFINAE rule in unique_ptr
templated assignment
* include/bits/unique_ptr.h
(__remove_cv, __is_derived_Tp): Remove.
(default_delete::default_delete(const default_delete<_Up[]>)):
Constrain with array convertibility.
(default_delete::operator(_Up*)): Turn into a template,
constrain with array convertibility.
(__safe_conversion_up): New, single object version.
(unique_ptr(unique_ptr<_Up, _Ep>&&)): Constrain with deleter
convertibility.
(unique_ptr::operator=(unique_ptr<_Up, _Ep>&&)): Likewise, and add
is_assignable as a constraint.
(__safe_conversion_up): Array version, renamed from __safe_conversion,
updated to implement N4089.
(__safe_conversion_raw): New.
(unique_ptr(_Up)): Turn into a template, constrain with array
convertibility.
(unique_ptr(_Up,
        typename conditional<is_reference<deleter_type>::value,
        deleter_type, const deleter_type&>::type)): Likewise.
(unique_ptr(_Up, typename
  remove_reference<deleter_type>::type&&)): Likewise.
(unique_ptr(unique_ptr<_Up, _Ep>&&)): Likewise.
(operator=(unique_ptr<_Up, _Ep>&&)): Likewise, and add
is_assignable as a constraint (array version).
(reset(_Up)): Turn into a template, constrain with array
convertibility.
(reset(nullptr_t)): New.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/dr2228.cc: New.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.

From-SVN: r226733
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/default_delete/48631_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635.cc
libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/assign/cv_qual.cc
libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual.cc
libstdc++-v3/testsuite/20_util/unique_ptr/dr2228.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/cv_qual.cc