Define feature-test macro for std::enable_shared_from_this
authorJonathan Wakely <jwakely@redhat.com>
Wed, 3 Aug 2016 19:10:06 +0000 (20:10 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 3 Aug 2016 19:10:06 +0000 (20:10 +0100)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc

index 2c23c4baf6873253856028518a47a47cf21091d7..d1162310bf6f76885088ba94bcaaa138f361426a 100644 (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.
index 93ce9013f30a313054799489ebf7978fb9d25b43..2698ba453a6a5ac9c2d24574494e519ab5b2a94d 100644 (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;
index 4ce23bc8479ac09f7c33d47b0c2f78e6675a1b89..1cf914805a478ef95df5a5d3b7a21993af5d55cf 100644 (file)
 #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