Another feature we already support, so just define the macro.

        * 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.

Tested x86_64-linux, committed to trunk.

commit 3a75677f2b6f2b3d2b01138c82bce5c051859e94
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Aug 3 19:47:53 2016 +0100

    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.

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h 
b/libstdc++-v3/include/bits/shared_ptr_base.h
index 93ce901..2698ba4 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 4ce23bc..1cf9148 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 <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

Reply via email to