[libcxx-commits] [libcxx] dc06688 - [libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C++20.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 15 12:05:58 PDT 2021


Author: Arthur O'Dwyer
Date: 2021-06-15T15:05:44-04:00
New Revision: dc066888bd98c0500ca7b590317dc91ccce0fd38

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

LOG: [libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C++20.

Differential Revision: https://reviews.llvm.org/D103753

Added: 
    libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp

Modified: 
    libcxx/docs/Cxx2aStatus.rst
    libcxx/docs/UsingLibcxx.rst
    libcxx/include/__config
    libcxx/include/__functional_base
    libcxx/include/__memory/shared_ptr.h
    libcxx/include/__memory/unique_ptr.h
    libcxx/include/functional
    libcxx/include/map
    libcxx/include/optional
    libcxx/include/utility
    libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
    libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
    libcxx/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
    libcxx/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
    libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
    libcxx/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
    libcxx/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/greater.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/less.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
    libcxx/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
    libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
    libcxx/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
    libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
    libcxx/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
    libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
    libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
    libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
    libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
    libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
    libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
    libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
    libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
    libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Cxx2aStatus.rst b/libcxx/docs/Cxx2aStatus.rst
index 8346760387fb..c96198bd3685 100644
--- a/libcxx/docs/Cxx2aStatus.rst
+++ b/libcxx/docs/Cxx2aStatus.rst
@@ -43,7 +43,7 @@ Paper Status
    .. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class], |sect|\ [mem.poly.allocator.class], and |sect|\ [container.node.overview].
    .. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 <https://llvm.org/PR45368>`__.
 
-   .. [#note-P0619] P0619: Only sections D.9 and D.10 are implemented. Section D.8 is partly implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone.
+   .. [#note-P0619] P0619: Only sections D.8, D.9, and D.10 are implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone.
 
 
 .. _issues-status-cxx2a:

diff  --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst
index 082eca2b22d2..88b287d5834c 100644
--- a/libcxx/docs/UsingLibcxx.rst
+++ b/libcxx/docs/UsingLibcxx.rst
@@ -256,6 +256,11 @@ C++20 Specific Configuration Macros:
   It also re-enables the library-provided explicit specializations
   of `allocator<void>` and `allocator<const void>`.
 
+**_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS**:
+  This macro is used to re-enable the `argument_type`, `result_type`,
+  `first_argument_type`, and `second_argument_type` members of class
+  templates such as `plus`, `logical_not`, `hash`, and `owner_less`.
+
 **_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS**:
   This macro is used to re-enable `not1`, `not2`, `unary_negate`,
   and `binary_negate`.

diff  --git a/libcxx/include/__config b/libcxx/include/__config
index 1f966ad1105d..abeb9a7f39ff 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -94,6 +94,9 @@
 #  define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
 // Enable optimized version of __do_get_(un)signed which avoids redundant copies.
 #  define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
+// In C++20 and later, don't derive std::plus from std::binary_function,
+// nor std::negate from std::unary_function.
+#  define _LIBCPP_ABI_NO_BINDER_BASES
 // Give reverse_iterator<T> one data member of type T, not two.
 // Also, in C++17 and later, don't derive iterator types from std::iterator.
 #  define _LIBCPP_ABI_NO_ITERATOR_BASES
@@ -1360,6 +1363,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
 
 #if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
 #define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
 #define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
 #define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
 #endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES

diff  --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base
index cdef0f88fcb5..b6f2efdfe9cb 100644
--- a/libcxx/include/__functional_base
+++ b/libcxx/include/__functional_base
@@ -42,14 +42,24 @@ public:
     static const bool value = sizeof(__test<_Tp>(0)) == 1;
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS less : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS less
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x < __y;}
@@ -373,7 +383,9 @@ struct __invoke_void_return_wrapper<_Ret, true>
 
 template <class _Tp>
 class _LIBCPP_TEMPLATE_VIS reference_wrapper
+#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public __weak_result_type<_Tp>
+#endif
 {
 public:
     // types

diff  --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index e7f9af6c32db..f3253625d708 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -1594,11 +1594,20 @@ template <class _Tp = void> struct owner_less;
 template <class _Tp> struct owner_less;
 #endif
 
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
+#endif
 {
-    typedef bool result_type;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> second_argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
         {return __x.owner_before(__y);}
@@ -1610,11 +1619,19 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
         {return __x.owner_before(__y);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> >
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
+#endif
 {
-    typedef bool result_type;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef weak_ptr<_Tp> first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef weak_ptr<_Tp> second_argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     bool operator()(  weak_ptr<_Tp> const& __x,   weak_ptr<_Tp> const& __y) const _NOEXCEPT
         {return __x.owner_before(__y);}
@@ -1690,11 +1707,13 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> >
 {
-    typedef shared_ptr<_Tp>      argument_type;
-    typedef size_t               result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t          result_type;
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator()(const argument_type& __ptr) const _NOEXCEPT
+    size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT
     {
         return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
     }

diff  --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 8148fad73da3..7585a918e62a 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -750,12 +750,15 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
     unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
 #endif
 {
-    typedef unique_ptr<_Tp, _Dp> argument_type;
-    typedef size_t               result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t               result_type;
+#endif
+
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator()(const argument_type& __ptr) const
+    size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const
     {
-        typedef typename argument_type::pointer pointer;
+        typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
         return hash<pointer>()(__ptr.get());
     }
 };

diff  --git a/libcxx/include/functional b/libcxx/include/functional
index 62e9b899e0af..89ee2a0ccf62 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -76,116 +76,97 @@ template <class T> using unwrap_reference_t = typename unwrap_reference<T>::type
 template <class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; // since C++20
 
 template <class T> // <class T=void> in C++14
-struct plus : binary_function<T, T, T>
-{
+struct plus {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct minus : binary_function<T, T, T>
-{
+struct minus {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct multiplies : binary_function<T, T, T>
-{
+struct multiplies {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct divides : binary_function<T, T, T>
-{
+struct divides {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct modulus : binary_function<T, T, T>
-{
+struct modulus {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct negate : unary_function<T, T>
-{
+struct negate {
     T operator()(const T& x) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct equal_to : binary_function<T, T, bool>
-{
+struct equal_to {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct not_equal_to : binary_function<T, T, bool>
-{
+struct not_equal_to {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct greater : binary_function<T, T, bool>
-{
+struct greater {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct less : binary_function<T, T, bool>
-{
+struct less {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct greater_equal : binary_function<T, T, bool>
-{
+struct greater_equal {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct less_equal : binary_function<T, T, bool>
-{
+struct less_equal {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct logical_and : binary_function<T, T, bool>
-{
+struct logical_and {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct logical_or : binary_function<T, T, bool>
-{
+struct logical_or {
     bool operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct logical_not : unary_function<T, bool>
-{
+struct logical_not {
     bool operator()(const T& x) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct bit_and : binary_function<T, T, T>
-{
+struct bit_and {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct bit_or : binary_function<T, T, T>
-{
+struct bit_or {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T> // <class T=void> in C++14
-struct bit_xor : binary_function<T, T, T>
-{
+struct bit_xor {
     T operator()(const T& x, const T& y) const;
 };
 
 template <class T=void> // C++14
-struct bit_not : unary_function<T, T>
-{
+struct bit_not {
     T operator()(const T& x) const;
 };
 
@@ -524,14 +505,24 @@ POLICY:  For non-variadic implementations, the number of arguments is limited
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS plus : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS plus
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x + __y;}
@@ -552,14 +543,24 @@ struct _LIBCPP_TEMPLATE_VIS plus<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS minus : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS minus
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x - __y;}
@@ -580,14 +581,24 @@ struct _LIBCPP_TEMPLATE_VIS minus<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS multiplies : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS multiplies
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x * __y;}
@@ -608,14 +619,24 @@ struct _LIBCPP_TEMPLATE_VIS multiplies<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS divides : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS divides
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x / __y;}
@@ -636,14 +657,24 @@ struct _LIBCPP_TEMPLATE_VIS divides<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS modulus : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS modulus
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x % __y;}
@@ -664,14 +695,23 @@ struct _LIBCPP_TEMPLATE_VIS modulus<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS negate : unary_function<_Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS negate
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : unary_function<_Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return -__x;}
@@ -692,14 +732,24 @@ struct _LIBCPP_TEMPLATE_VIS negate<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS equal_to : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS equal_to
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x == __y;}
@@ -720,14 +770,24 @@ struct _LIBCPP_TEMPLATE_VIS equal_to<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS not_equal_to : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS not_equal_to
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x != __y;}
@@ -748,14 +808,24 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS greater
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x > __y;}
@@ -778,14 +848,25 @@ struct _LIBCPP_TEMPLATE_VIS greater<void>
 
 // less in <__functional_base>
 
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS greater_equal
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x >= __y;}
@@ -806,14 +887,24 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS less_equal : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS less_equal
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x <= __y;}
@@ -834,14 +925,24 @@ struct _LIBCPP_TEMPLATE_VIS less_equal<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS logical_and : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS logical_and
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x && __y;}
@@ -862,14 +963,24 @@ struct _LIBCPP_TEMPLATE_VIS logical_and<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS logical_or : binary_function<_Tp, _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS logical_or
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x || __y;}
@@ -890,14 +1001,23 @@ struct _LIBCPP_TEMPLATE_VIS logical_or<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS logical_not : unary_function<_Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS logical_not
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : unary_function<_Tp, bool>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef bool __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x) const
         {return !__x;}
@@ -918,14 +1038,24 @@ struct _LIBCPP_TEMPLATE_VIS logical_not<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS bit_and : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS bit_and
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x & __y;}
@@ -946,14 +1076,24 @@ struct _LIBCPP_TEMPLATE_VIS bit_and<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS bit_or : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS bit_or
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x | __y;}
@@ -974,14 +1114,24 @@ struct _LIBCPP_TEMPLATE_VIS bit_or<void>
 #endif
 
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #if _LIBCPP_STD_VER > 11
 template <class _Tp = void>
 #else
 template <class _Tp>
 #endif
-struct _LIBCPP_TEMPLATE_VIS bit_xor : binary_function<_Tp, _Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS bit_xor
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : binary_function<_Tp, _Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     typedef _Tp __result_type;  // used by valarray
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x ^ __y;}
@@ -1003,9 +1153,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
 
 
 #if _LIBCPP_STD_VER > 11
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp = void>
-struct _LIBCPP_TEMPLATE_VIS bit_not : unary_function<_Tp, _Tp>
+struct _LIBCPP_TEMPLATE_VIS bit_not
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+    : unary_function<_Tp, _Tp>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return ~__x;}
@@ -1307,7 +1466,9 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
 
 template <class _Tp>
 class __mem_fn
+#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public __weak_result_type<_Tp>
+#endif
 {
 public:
     // types
@@ -2354,8 +2515,10 @@ public:
 
 template<class _Rp, class ..._ArgTypes>
 class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
+#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
       public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
+#endif
 {
 #ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
     typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
@@ -2884,7 +3047,9 @@ __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
 
 template<class _Fp, class ..._BoundArgs>
 class __bind
+#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public __weak_result_type<typename decay<_Fp>::type>
+#endif
 {
 protected:
     typedef typename decay<_Fp>::type _Fd;

diff  --git a/libcxx/include/map b/libcxx/include/map
index 22376f30680f..c7f7df2fc9b9 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -43,7 +43,6 @@ public:
     typedef INSERT_RETURN_TYPE<iterator, node_type>  insert_return_type;     // C++17
 
     class value_compare
-        : public binary_function<value_type, value_type, bool>
     {
         friend class map;
     protected:
@@ -51,6 +50,9 @@ public:
 
         value_compare(key_compare c);
     public:
+        typedef bool result_type;  // deprecated in C++17, removed in C++20
+        typedef value_type first_argument_type;  // deprecated in C++17, removed in C++20
+        typedef value_type second_argument_type;  // deprecated in C++17, removed in C++20
         bool operator()(const value_type& x, const value_type& y) const;
     };
 
@@ -287,13 +289,15 @@ public:
     typedef unspecified                              node_type;              // C++17
 
     class value_compare
-        : public binary_function<value_type,value_type,bool>
     {
         friend class multimap;
     protected:
         key_compare comp;
         value_compare(key_compare c);
     public:
+        typedef bool result_type;  // deprecated in C++17, removed in C++20
+        typedef value_type first_argument_type;  // deprecated in C++17, removed in C++20
+        typedef value_type second_argument_type;  // deprecated in C++17, removed in C++20
         bool operator()(const value_type& x, const value_type& y) const;
     };
 
@@ -922,15 +926,24 @@ public:
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     class _LIBCPP_TEMPLATE_VIS value_compare
+#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
         : public binary_function<value_type, value_type, bool>
+#endif
     {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
         friend class map;
     protected:
         key_compare comp;
 
         _LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
     public:
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef value_type first_argument_type;
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef value_type second_argument_type;
+#endif
         _LIBCPP_INLINE_VISIBILITY
         bool operator()(const value_type& __x, const value_type& __y) const
             {return comp(__x.first, __y.first);}
@@ -1696,9 +1709,13 @@ public:
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     class _LIBCPP_TEMPLATE_VIS value_compare
+#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
         : public binary_function<value_type, value_type, bool>
+#endif
     {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
         friend class multimap;
     protected:
         key_compare comp;
@@ -1706,6 +1723,11 @@ public:
         _LIBCPP_INLINE_VISIBILITY
         value_compare(key_compare c) : comp(c) {}
     public:
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef value_type first_argument_type;
+        _LIBCPP_DEPRECATED_IN_CXX17 typedef value_type second_argument_type;
+#endif
         _LIBCPP_INLINE_VISIBILITY
         bool operator()(const value_type& __x, const value_type& __y) const
             {return comp(__x.first, __y.first);}

diff  --git a/libcxx/include/optional b/libcxx/include/optional
index 8a291a6ac2db..0e6c1b88f52c 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -1407,11 +1407,13 @@ struct _LIBCPP_TEMPLATE_VIS hash<
     __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>>
 >
 {
-    typedef optional<_Tp> argument_type;
-    typedef size_t        result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t        result_type;
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator()(const argument_type& __opt) const
+    size_t operator()(const optional<_Tp>& __opt) const
     {
         return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
     }

diff  --git a/libcxx/include/utility b/libcxx/include/utility
index d895cfe5367a..1060b5c8ab11 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -1298,10 +1298,18 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
 template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
 struct __scalar_hash;
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct __scalar_hash<_Tp, 0>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1316,10 +1324,18 @@ struct __scalar_hash<_Tp, 0>
     }
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct __scalar_hash<_Tp, 1>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1333,10 +1349,18 @@ struct __scalar_hash<_Tp, 1>
     }
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct __scalar_hash<_Tp, 2>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1354,10 +1378,18 @@ struct __scalar_hash<_Tp, 2>
     }
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct __scalar_hash<_Tp, 3>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1376,10 +1408,18 @@ struct __scalar_hash<_Tp, 3>
     }
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp>
 struct __scalar_hash<_Tp, 4>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1411,10 +1451,18 @@ inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
     return _HashT()(__p);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template<class _Tp>
 struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp*, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp* __v) const _NOEXCEPT
     {
@@ -1428,44 +1476,83 @@ struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
     }
 };
 
-
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<bool>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<bool, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef bool argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<char>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<char, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef char argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<signed char>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<signed char, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef signed char argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<unsigned char, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned char argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
 #ifndef _LIBCPP_HAS_NO_CHAR8_T
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<char8_t, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef char8_t argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
@@ -1473,76 +1560,148 @@ struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
 
 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<char16_t, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef char16_t argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<char32_t, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef char32_t argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<wchar_t, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef wchar_t argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<short>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<short, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef short argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<unsigned short, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned short argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<int>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<int, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef int argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<unsigned int, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned int argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<long>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<long, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef long argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<unsigned long, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned long argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
 };
@@ -1655,10 +1814,18 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
 
 #if _LIBCPP_STD_VER > 11
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp, bool = is_enum<_Tp>::value>
 struct _LIBCPP_TEMPLATE_VIS __enum_hash
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
     : public unary_function<_Tp, size_t>
+#endif
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
+#endif
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(_Tp __v) const _NOEXCEPT
     {
@@ -1681,14 +1848,22 @@ struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
 
 #if _LIBCPP_STD_VER > 14
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
+#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
   : public unary_function<nullptr_t, size_t>
+#endif
 {
-  _LIBCPP_INLINE_VISIBILITY
-  size_t operator()(nullptr_t) const _NOEXCEPT {
-    return 662607004ull;
-  }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef nullptr_t argument_type;
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(nullptr_t) const _NOEXCEPT {
+        return 662607004ull;
+    }
 };
 #endif
 

diff  --git a/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp b/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp
new file mode 100644
index 000000000000..422f40504220
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// UNSUPPORTED: c++03, c++11, c++14
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <optional>
+#include <utility>
+#include "test_macros.h"
+
+void test_functional()
+{
+    {
+        using T = std::plus<int>;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+    {
+        using T = std::less<int>;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+    {
+        using T = std::logical_not<int>;
+        T::result_type a;    // expected-warning {{is deprecated}}
+        T::argument_type b;  // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+    }
+}
+
+void test_owner_less()
+{
+    {
+        using T = std::owner_less<std::shared_ptr<int>>;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+    {
+        using T = std::owner_less<std::weak_ptr<int>>;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+}
+
+void test_hash()
+{
+    {
+        using T = std::hash<int>;
+        T::result_type a;   // expected-warning {{is deprecated}}
+        T::argument_type b; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+    }
+    {
+        using T = std::hash<std::shared_ptr<int>>;
+        T::result_type a;   // expected-warning {{is deprecated}}
+        T::argument_type b; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+    }
+    {
+        using T = std::hash<std::unique_ptr<int>>;
+        T::result_type a;   // expected-warning {{is deprecated}}
+        T::argument_type b; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+    }
+    {
+        using T = std::hash<std::optional<int>>;
+        T::result_type a;   // expected-warning {{is deprecated}}
+        T::argument_type b; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+    }
+}
+
+void test_map()
+{
+    {
+        using T = std::map<int, int>::value_compare;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+    {
+        using T = std::multimap<int, int>::value_compare;
+        T::result_type a;          // expected-warning {{is deprecated}}
+        T::first_argument_type b;  // expected-warning {{is deprecated}}
+        T::second_argument_type c; // expected-warning {{is deprecated}}
+        (void)a;
+        (void)b;
+        (void)c;
+    }
+}

diff  --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
index 8532ca740b63..0fd08cebd837 100644
--- a/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+
 // <functional>
 
 // reference_wrapper

diff  --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
index 09c304397d00..33b3336f6374 100644
--- a/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+
 // <functional>
 
 // reference_wrapper

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
index 1dbbd8533c7d..6afdb0f544ed 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // divides
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::divides<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(36, 4) == 9);
 #if TEST_STD_VER > 11
     typedef std::divides<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
index 186695f7b93e..273054cf198d 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // minus
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::minus<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(3, 2) == 1);
 #if TEST_STD_VER > 11
     typedef std::minus<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
index 3679a2d32513..4ce6a0f32543 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // modulus
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::modulus<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(36, 8) == 4);
 #if TEST_STD_VER > 11
     typedef std::modulus<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
index a09e59c784c7..d4f0a3e66ec1 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // multiplies
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::multiplies<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(3, 2) == 6);
 #if TEST_STD_VER > 11
     typedef std::multiplies<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
index 553bf83e2d4c..fd3d5f5f0700 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // negate
@@ -20,8 +22,10 @@ int main(int, char**)
 {
     typedef std::negate<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<F::argument_type, int>::value), "" );
     static_assert((std::is_same<F::result_type, int>::value), "" );
+#endif
     assert(f(36) == -36);
 #if TEST_STD_VER > 11
     typedef std::negate<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
index b2614f4304d2..06eb172c65e2 100644
--- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // plus
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::plus<int> F;
     const F f = F();
-    static_assert((std::is_same<int, F::first_argument_type>::value), "" );
-    static_assert((std::is_same<int, F::second_argument_type>::value), "" );
-    static_assert((std::is_same<int, F::result_type>::value), "" );
+#if TEST_STD_VER <= 17
+    static_assert((std::is_same<int, F::first_argument_type>::value), "");
+    static_assert((std::is_same<int, F::second_argument_type>::value), "");
+    static_assert((std::is_same<int, F::result_type>::value), "");
+#endif
     assert(f(3, 2) == 5);
 #if TEST_STD_VER > 11
     typedef std::plus<> F2;

diff  --git a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
index aa5324621454..621479b51ac9 100644
--- a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // bit_and
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::bit_and<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(0xEA95, 0xEA95) == 0xEA95);
     assert(f(0xEA95, 0x58D3) == 0x4891);
     assert(f(0x58D3, 0xEA95) == 0x4891);

diff  --git a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
index f0ee08060019..4a6acddec2ff 100644
--- a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // bit_not
@@ -21,8 +23,10 @@ int main(int, char**)
 {
     typedef std::bit_not<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<F::argument_type, int>::value), "" );
     static_assert((std::is_same<F::result_type, int>::value), "" );
+#endif
     assert((f(0xEA95) & 0xFFFF ) == 0x156A);
     assert((f(0x58D3) & 0xFFFF ) == 0xA72C);
     assert((f(0)      & 0xFFFF ) == 0xFFFF);

diff  --git a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
index 8abcd63afaa7..442363d107a6 100644
--- a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // bit_or
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::bit_or<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(0xEA95, 0xEA95) == 0xEA95);
     assert(f(0xEA95, 0x58D3) == 0xFAD7);
     assert(f(0x58D3, 0xEA95) == 0xFAD7);

diff  --git a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
index 070bd4c5f7b1..eff1beadef78 100644
--- a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // bit_xor
@@ -21,9 +23,11 @@ int main(int, char**)
     {
     typedef std::bit_xor<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<int, F::result_type>::value), "" );
+#endif
     assert(f(0xEA95, 0xEA95) == 0);
     assert(f(0xEA95, 0x58D3) == 0xB246);
     assert(f(0x58D3, 0xEA95) == 0xB246);

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
index beed574f89e6..0a1020994891 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // equal_to
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::equal_to<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(f(36, 36));
     assert(!f(36, 6));
 #if TEST_STD_VER > 11

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/greater.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/greater.pass.cpp
index 1f79d2351327..660c4d3d4f3e 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/greater.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/greater.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // greater
@@ -21,9 +23,11 @@ int main(int, char**)
 {
     typedef std::greater<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(!f(36, 36));
     assert(f(36, 6));
     assert(!f(6, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
index f259b5d27ddb..597761587aed 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // greater_equal
@@ -21,9 +23,11 @@ int main(int, char**)
 {
     typedef std::greater_equal<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(f(36, 36));
     assert(f(36, 6));
     assert(!f(6, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/less.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/less.pass.cpp
index c5da63c1f41e..976f6e82c87e 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/less.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/less.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // less
@@ -21,9 +23,11 @@ int main(int, char**)
 {
     typedef std::less<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(!f(36, 36));
     assert(!f(36, 6));
     assert(f(6, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
index fe91f2728fd8..fa38fe451055 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // less_equal
@@ -21,9 +23,11 @@ int main(int, char**)
 {
     typedef std::less_equal<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(f(36, 36));
     assert(!f(36, 6));
     assert(f(6, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp b/libcxx/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
index 0e405de1be97..1d4a03c959fa 100644
--- a/libcxx/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // not_equal_to
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::not_equal_to<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(!f(36, 36));
     assert(f(36, 6));
 #if TEST_STD_VER > 11

diff  --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
index 6ca1a658e3f1..8142f74a18f9 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
@@ -70,7 +70,9 @@ class has_second_argument_type
 template <class F, class return_type>
 void test_nullary_function ()
 {
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
+#endif
     static_assert((!has_argument_type<F>::value), "" );
     static_assert((!has_first_argument_type<F>::value), "" );
     static_assert((!has_second_argument_type<F>::value), "" );
@@ -79,8 +81,10 @@ void test_nullary_function ()
 template <class F, class return_type, class arg_type>
 void test_unary_function ()
 {
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
     static_assert((std::is_same<typename F::argument_type,  arg_type>::value), "" );
+#endif
     static_assert((!has_first_argument_type<F>::value), "" );
     static_assert((!has_second_argument_type<F>::value), "" );
 }
@@ -88,16 +92,20 @@ void test_unary_function ()
 template <class F, class return_type, class arg_type1, class arg_type2>
 void test_binary_function ()
 {
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<typename F::result_type,        return_type>::value), "" );
     static_assert((std::is_same<typename F::first_argument_type,  arg_type1>::value), "" );
     static_assert((std::is_same<typename F::second_argument_type, arg_type2>::value), "" );
+#endif
     static_assert((!has_argument_type<F>::value), "" );
 }
 
 template <class F, class return_type>
 void test_other_function ()
 {
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
+#endif
     static_assert((!has_argument_type<F>::value), "" );
     static_assert((!has_first_argument_type<F>::value), "" );
     static_assert((!has_second_argument_type<F>::value), "" );

diff  --git a/libcxx/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp b/libcxx/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
index 29767a58c48b..d0c58b666177 100644
--- a/libcxx/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // logical_and
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::logical_and<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(f(36, 36));
     assert(!f(36, 0));
     assert(!f(0, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp b/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
index e93fd06fdd5a..338101596c0a 100644
--- a/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // logical_not
@@ -20,8 +22,10 @@ int main(int, char**)
 {
     typedef std::logical_not<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<F::argument_type, int>::value), "" );
     static_assert((std::is_same<F::result_type, bool>::value), "" );
+#endif
     assert(!f(36));
     assert(f(0));
 #if TEST_STD_VER > 11

diff  --git a/libcxx/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp b/libcxx/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
index abe536572ea4..1388375bea08 100644
--- a/libcxx/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // logical_or
@@ -20,9 +22,11 @@ int main(int, char**)
 {
     typedef std::logical_or<int> F;
     const F f = F();
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, F::result_type>::value), "" );
+#endif
     assert(f(36, 36));
     assert(f(36, 0));
     assert(f(0, 36));

diff  --git a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
index 83ea155b8141..a3c54fa803e1 100644
--- a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
@@ -10,6 +10,7 @@
 
 // binary_negate
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 

diff  --git a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
index 638959266e09..623c6cb7e506 100644
--- a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
@@ -10,6 +10,7 @@
 
 // not1
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 

diff  --git a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
index 523fcd5e2630..e097f272b76c 100644
--- a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
@@ -10,6 +10,7 @@
 
 // not2
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 

diff  --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
index d3fb9bd08919..589b17e4c90e 100644
--- a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
@@ -10,6 +10,7 @@
 
 // unary_negate
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 

diff  --git a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
index 506f2945e407..4aece56b7211 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // UNSUPPORTED: c++03, c++11
 
 // <functional>
@@ -33,8 +35,10 @@ void
 test()
 {
     typedef std::hash<T> H;
-    static_assert((std::is_same<typename H::argument_type, T>::value), "" );
-    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+#if TEST_STD_VER <= 17
+    static_assert((std::is_same<typename H::argument_type, T>::value), "");
+    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "");
+#endif
     ASSERT_NOEXCEPT(H()(T()));
     typedef typename std::underlying_type<T>::type under_type;
 

diff  --git a/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
index 31b1b2d07e40..b8f85e193dc8 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // template <class T>
@@ -30,8 +32,10 @@ void
 test()
 {
     typedef std::hash<T> H;
-    static_assert((std::is_same<typename H::argument_type, T>::value), "" );
-    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+#if TEST_STD_VER <= 17
+    static_assert((std::is_same<typename H::argument_type, T>::value), "");
+    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "");
+#endif
     ASSERT_NOEXCEPT(H()(T()));
     H h;
 

diff  --git a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
index dbd44a88207b..031aa30f2b05 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // template <class T>
@@ -28,8 +30,10 @@ void
 test()
 {
     typedef std::hash<T> H;
-    static_assert((std::is_same<typename H::argument_type, T>::value), "" );
-    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+#if TEST_STD_VER <= 17
+    static_assert((std::is_same<typename H::argument_type, T>::value), "");
+    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "");
+#endif
     ASSERT_NOEXCEPT(H()(T()));
     H h;
 

diff  --git a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
index 17dfdce2d4a8..577a9bf0e15b 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <functional>
 
 // template <class T>
@@ -29,8 +31,10 @@ void
 test()
 {
     typedef std::hash<T> H;
-    static_assert((std::is_same<typename H::argument_type, T>::value), "" );
-    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+#if TEST_STD_VER <= 17
+    static_assert((std::is_same<typename H::argument_type, T>::value), "");
+    static_assert((std::is_same<typename H::result_type, std::size_t>::value), "");
+#endif
     ASSERT_NOEXCEPT(H()(T()));
     H h;
 
@@ -46,8 +50,10 @@ void test_nullptr()
 #if TEST_STD_VER > 14
     typedef std::nullptr_t T;
     typedef std::hash<T> H;
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<typename H::argument_type, T>::value), "" );
     static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+#endif
     ASSERT_NOEXCEPT(H()(T()));
 #endif
 }

diff  --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
index b3cc13d72a89..132065acbc6d 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <memory>
 
 // template <class T> struct owner_less;
@@ -65,9 +67,11 @@ int main(int, char**)
     typedef std::owner_less<std::shared_ptr<int> > CS;
     CS cs;
 
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<std::shared_ptr<int>, CS::first_argument_type>::value), "" );
     static_assert((std::is_same<std::shared_ptr<int>, CS::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, CS::result_type>::value), "" );
+#endif
 
     assert(!cs(p1, p2));
     assert(!cs(p2, p1));
@@ -86,9 +90,11 @@ int main(int, char**)
     typedef std::owner_less<std::weak_ptr<int> > CS;
     CS cs;
 
+#if TEST_STD_VER <= 17
     static_assert((std::is_same<std::weak_ptr<int>, CS::first_argument_type>::value), "" );
     static_assert((std::is_same<std::weak_ptr<int>, CS::second_argument_type>::value), "" );
     static_assert((std::is_same<bool, CS::result_type>::value), "" );
+#endif
 
     assert(!cs(w1, w2));
     assert(!cs(w2, w1));


        


More information about the libcxx-commits mailing list