Make std::enable_shared_from_this cope with ambiguity
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Oct 2016 20:13:14 +0000 (21:13 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 19 Oct 2016 20:13:14 +0000 (21:13 +0100)
commitf3070dab7a2ded2c2ee612d6e48ca01b77327379
tree1917429d34a69abb800637b49545416e81cd3e74
parentbdcf8e7c55b6d54062f7bcd3a099c732b84a1e19
Make std::enable_shared_from_this cope with ambiguity

* include/backward/auto_ptr.h (__shared_ptr(auto_ptr&&)): Call
_M_enable_shared_from_this_with instead of
__enable_shared_from_this_helper.
* include/bits/shared_ptr.h (__enable_shared_from_this_helper):
Remove overload for std::enable_shared_from_this..
(__enable_shared_from_this_base): Define friend function to select a
std::enable_shared_from_this base class.
* include/bits/shared_ptr_base.h (__enable_shared_from_this_helper):
Remove all overloads.
(__shared_ptr): Change all relevant constructors to call
_M_enable_shared_from_this_with instead of
__enable_shared_from_this_helper.
(__shared_ptr::__efst_base_t, __shared_ptr::__has_efst_base): Helpers
to detect accessible and unambiguous enable_shared_from_this bases.
(__shared_ptr::_M_enable_shared_from_this_with): New function to
replace __enable_shared_from_this_helper overloads.
(__enable_shared_from_this_helper): Remove overload for
std::__enable_shared_from_this.
(__enable_shared_from_this_base): Define friend function to select a
std::__enable_shared_from_this base class.
* include/experimental/bits/shared_ptr.h (experimental::shared_ptr):
Change relevant constructors to call _M_enable_shared_from_this_with.
(experimental::shared_ptr::__efst_base_t)
(experimental::shared_ptr::__has_efst_base): Helpers to detect
accessible and unambiguous enable_shared_from_this bases.
(experimental::shared_ptr::_M_enable_shared_from_this_with): Define.
(experimental::__enable_shared_from_this_helper): Remove overload for
std::experimental::enable_shared_from_this.
(experimental::__expt_enable_shared_from_this_base): Define friend
function to select a std::experimental::enable_shared_from_this base.
* testsuite/experimental/memory/shared_ptr/cons/
enable_shared_from_this.cc: New test.
* testsuite/experimental/memory/shared_ptr/cons/unique_ptr_ctor.cc:
Adjust expected behaviour for shared_ptr<A[]>.

From-SVN: r241353
libstdc++-v3/ChangeLog
libstdc++-v3/include/backward/auto_ptr.h
libstdc++-v3/include/bits/shared_ptr.h
libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/include/experimental/bits/shared_ptr.h
libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/enable_shared_from_this.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/unique_ptr_ctor.cc