https://gcc.gnu.org/g:1a3723cacbed638006825e1c3e9af7687fc247a9

commit r17-7166-g1a3723cacbed638006825e1c3e9af7687fc247a9
Author: Jonathan Wakely <[email protected]>
Date:   Fri Dec 4 10:49:13 2026 +0000

    libstdc++: Do not define std::owner_less<void>::is_transparent in C++11
    
    When I implemented P0074R0 (Making std::owner_less more flexible) in
    commit r7-2407-gb7dabce5f3a4f3 I treated it as a DR and enabled the new
    specialization all the way back to C++11. But its is_transparent member
    type should not be defined for C++11 because that's not a reserved name
    until C++14.
    
    My recent r17-7085-gf93466b7fd6844 change caused 17_intro/names.cc to
    fail in C++11 mode because it checks that is_transparent isn't used
    before C++14.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/shared_ptr_base.h (_Sp_owner_less<void, void>):
            Only define is_transparent for C++14 and later.
            * testsuite/20_util/owner_less/void.cc: Check the type is
            present when it should be.

Diff:
---
 libstdc++-v3/include/bits/shared_ptr_base.h       | 2 ++
 libstdc++-v3/testsuite/20_util/owner_less/void.cc | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h 
b/libstdc++-v3/include/bits/shared_ptr_base.h
index b67a697c6df6..b2c221a154d5 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -2287,7 +2287,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        -> decltype(__lhs.owner_before(__rhs))
        { return __lhs.owner_before(__rhs); }
 
+#ifdef __glibcxx_transparent_operators // C++ >= 14
       using is_transparent = void;
+#endif
     };
 
   template<typename _Tp, _Lock_policy _Lp>
diff --git a/libstdc++-v3/testsuite/20_util/owner_less/void.cc 
b/libstdc++-v3/testsuite/20_util/owner_less/void.cc
index 0c91861fca1e..cfcfe535e285 100644
--- a/libstdc++-v3/testsuite/20_util/owner_less/void.cc
+++ b/libstdc++-v3/testsuite/20_util/owner_less/void.cc
@@ -28,6 +28,10 @@
 # endif
 #endif
 
+#if __cpp_lib_transparent_operators >= 201510
+using check_type_exists = std::owner_less<void>::is_transparent;
+#endif
+
 void
 test01()
 {

Reply via email to