Constrain std::shared_ptr assignment and resetting
authorJonathan Wakely <jwakely@redhat.com>
Wed, 31 Aug 2016 16:57:20 +0000 (17:57 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 31 Aug 2016 16:57:20 +0000 (17:57 +0100)
commit7663cae227b8337bbcf3355698b2aa43cb1a5f70
treed67ccc26639c2c37194d284938a2c2d7da567bca
parente46d22a82119006ef69b4ba101565014ccaa9223
Constrain std::shared_ptr assignment and resetting

* include/bits/shared_ptr.h (_Assignable): New alias template.
(shared_ptr::operator=(const shared_ptr<_Tp1>&))
(shared_ptr::operator=(shared_ptr<_Tp1>&&))
(shared_ptr::operator=(unique_ptr<_Tp1>&&)): Constrain with
_Assignable.
* include/bits/shared_ptr_base.h (_Assignable): New alias template.
(__shared_ptr::operator=(const __shared_ptr<_Tp1>&))
(__shared_ptr::operator=(__shared_ptr<_Tp1>&&))
(__shared_ptr::operator=(unique_ptr<_Tp1>&&)): Constrain with
_Assignable.
(__shared_ptr::reset(_Tp1*), __shared_ptr::reset(_Tp1*, _Deleter))
(__shared_ptr::reset(_Tp1*, _Deleter, _Alloc)): Constrain with
_Convertible.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Change dg-error to
match on any line.
* testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/sfinae.cc: New test.
* testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc: Update
expected errors. Remove unnecessary code.
* testsuite/20_util/shared_ptr/modifiers/reset_sfinae.cc: New test.

From-SVN: r239898
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr.h
libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/testsuite/20_util/shared_ptr/assign/sfinae.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_sfinae.cc [new file with mode: 0644]