[libcxx-commits] [libcxx] 30cbdcb - [libc++] Revert to previous implementation of __has_rebind

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 4 10:56:52 PST 2020


Author: Louis Dionne
Date: 2020-03-04T13:55:35-05:00
New Revision: 30cbdcb5c3694e2e6c4647ce88df9e3692bf90cf

URL: https://github.com/llvm/llvm-project/commit/30cbdcb5c3694e2e6c4647ce88df9e3692bf90cf
DIFF: https://github.com/llvm/llvm-project/commit/30cbdcb5c3694e2e6c4647ce88df9e3692bf90cf.diff

LOG: [libc++] Revert to previous implementation of __has_rebind

The new implementation introduced in 5b1e5b43 broke the bot running GCC 5.

Added: 
    

Modified: 
    libcxx/include/memory

Removed: 
    


################################################################################
diff  --git a/libcxx/include/memory b/libcxx/include/memory
index 9d56e8167b47..bea55d65fb99 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -841,12 +841,16 @@ struct __pointer_traits_
diff erence_type<_Ptr, true>
     typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::
diff erence_type type;
 };
 
-template <class _Tp, class _Up, class = void>
-struct __has_rebind : false_type {};
-
 template <class _Tp, class _Up>
-struct __has_rebind<_Tp, _Up,
-    typename __void_t<typename _Tp::template rebind<_Up> >::type> : true_type {};
+struct __has_rebind
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Xp> static __two __test(...);
+    template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
 
 template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
 struct __pointer_traits_rebind


        


More information about the libcxx-commits mailing list