Define feature-test macro for std::enable_shared_from_this

* include/bits/shared_ptr_base.h (__cpp_lib_enable_shared_from_this):
	Define feature-test macro.
	* testsuite/20_util/enable_shared_from_this/members/reinit.cc: Test
	for the macro.

From-SVN: r239094
This commit is contained in:
Jonathan Wakely 2016-08-03 20:10:06 +01:00 committed by Jonathan Wakely
parent f21f4463ad
commit c7fdbdcdbd
3 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,10 @@
2016-08-03 Jonathan Wakely <jwakely@redhat.com>
* include/bits/shared_ptr_base.h (__cpp_lib_enable_shared_from_this):
Define feature-test macro.
* testsuite/20_util/enable_shared_from_this/members/reinit.cc: Test
for the macro.
* include/bits/shared_ptr.h (shared_ptr::weak_type): Define.
* include/bits/shared_ptr_base.h (__shared_ptr::weak_type): Define.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust dg-error.

View File

@ -1472,6 +1472,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
_M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) noexcept
{
#define __cpp_lib_enable_shared_from_this 201603
if (use_count() == 0)
{
_M_ptr = __ptr;

View File

@ -20,6 +20,10 @@
#include <memory>
#include <testsuite_hooks.h>
#if __cpp_lib_enable_shared_from_this < 201603
# error "__cpp_lib_enable_shared_from_this < 201603"
#endif
struct X : public std::enable_shared_from_this<X> { };
bool