diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2c23c4baf68..d1162310bf6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2016-08-03 Jonathan Wakely + * 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. diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 93ce9013f30..2698ba453a6 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -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; diff --git a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc index 4ce23bc8479..1cf914805a4 100644 --- a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc +++ b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc @@ -20,6 +20,10 @@ #include #include +#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 { }; bool