]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use feature test macro for pmr::polymorphic_allocator<>
authorJonathan Wakely <jwakely@redhat.com>
Tue, 10 Dec 2024 14:35:07 +0000 (14:35 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 9 Jan 2025 23:52:33 +0000 (23:52 +0000)
Check the __glibcxx_polymorphic_allocator macro instead of just checking
whether __cplusplus > 201703L.

libstdc++-v3/ChangeLog:

* include/bits/memory_resource.h (polymoprhic_allocator): Use
feature test macro for P0339R6 features.

(cherry picked from commit b26d92f4f71594206385d6f645ff626c0bf9b59c)

libstdc++-v3/include/bits/memory_resource.h

index db515fb30ef93550184b542c1a8c8a3f77030f26..9bfeaedf078db955300ff744e96137666eac84dd 100644 (file)
@@ -168,7 +168,7 @@ namespace pmr
       __attribute__((__nonnull__))
       { _M_resource->deallocate(__p, __n * sizeof(_Tp), alignof(_Tp)); }
 
-#if __cplusplus > 201703L
+#ifdef __glibcxx_polymorphic_allocator // >= C++20
       [[nodiscard]] void*
       allocate_bytes(size_t __nbytes,
                     size_t __alignment = alignof(max_align_t))
@@ -218,9 +218,9 @@ namespace pmr
          __p->~_Up();
          deallocate_object(__p);
        }
-#endif // C++2a
+#endif // C++20
 
-#if ! __glibcxx_make_obj_using_allocator
+#if ! __glibcxx_make_obj_using_allocator // >= C++20
       template<typename _Tp1, typename... _Args>
        __attribute__((__nonnull__))
        typename __not_pair<_Tp1>::type
@@ -336,7 +336,7 @@ namespace pmr
 #endif
 
     private:
-#if ! __glibcxx_make_obj_using_allocator
+#if ! __glibcxx_make_obj_using_allocator // >= C++20
       using __uses_alloc1_ = __uses_alloc1<polymorphic_allocator>;
       using __uses_alloc2_ = __uses_alloc2<polymorphic_allocator>;