diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -89,6 +89,12 @@ - ``vector::const_reference``, ``vector::const_iterator::reference`` and ``bitset::const_reference`` are now aliases for `bool` in the unstable ABI. +- ``unary_function`` and ``binary_function`` are no longer available in C++17 and C++20. + They can be re-enabled by defining ``_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION``. + They are also marked as ``[[deprecated]]`` in C++11 and later. To disable deprecation warnings + you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this disables + all deprectation warnings. + ABI Changes ----------- diff --git a/libcxx/docs/Status/Cxx17Papers.csv b/libcxx/docs/Status/Cxx17Papers.csv --- a/libcxx/docs/Status/Cxx17Papers.csv +++ b/libcxx/docs/Status/Cxx17Papers.csv @@ -2,7 +2,7 @@ "`N3911 `__","LWG","TransformationTrait Alias ``void_t``\ .","Urbana","|Complete|","3.6" "`N4089 `__","LWG","Safe conversions in ``unique_ptr``\ .","Urbana","|In Progress|","3.9" "`N4169 `__","LWG","A proposal to add invoke function template","Urbana","|Complete|","3.7" -"`N4190 `__","LWG","Removing auto_ptr, random_shuffle(), And Old Stuff.","Urbana","|In Progress|","" +"`N4190 `__","LWG","Removing auto_ptr, random_shuffle(), And Old Stuff.","Urbana","|Complete|","15.0" "`N4258 `__","LWG","Cleaning-up noexcept in the Library.","Urbana","|In Progress|","3.7" "`N4259 `__","CWG","Wording for std::uncaught_exceptions","Urbana","|Complete|","3.7" "`N4277 `__","LWG","TriviallyCopyable ``reference_wrapper``\ .","Urbana","|Complete|","3.2" diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1220,6 +1220,7 @@ #define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +#define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES #if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) diff --git a/libcxx/include/__functional/binary_function.h b/libcxx/include/__functional/binary_function.h --- a/libcxx/include/__functional/binary_function.h +++ b/libcxx/include/__functional/binary_function.h @@ -18,14 +18,45 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) + template -struct _LIBCPP_TEMPLATE_VIS binary_function +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function { typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; }; +#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) + +template struct __binary_function_keep_layout_base { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1; + using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2; + using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; +#endif +}; + +template struct __binary_function_ebo_base { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1; + using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2; + using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; +#endif +}; + +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) +template +using __binary_function_or_empty = binary_function<_Arg1, _Arg2, _Result>; +#elif defined(_LIBCPP_ABI_NO_BINDER_BASES) +template +using __binary_function_or_empty = __binary_function_ebo_base<_Derived, _Arg1, _Arg2, _Result>; +#else +template +using __binary_function_or_empty = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>; +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FUNCTIONAL_BINARY_FUNCTION_H diff --git a/libcxx/include/__functional/binary_negate.h b/libcxx/include/__functional/binary_negate.h --- a/libcxx/include/__functional/binary_negate.h +++ b/libcxx/include/__functional/binary_negate.h @@ -23,9 +23,10 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate - : public binary_function + : public __binary_function_or_empty, + typename _Predicate::first_argument_type, + typename _Predicate::second_argument_type, + bool> { _Predicate __pred_; public: @@ -36,6 +37,10 @@ bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const {return !__pred_(__x, __y);} + + using first_argument_type = typename _Predicate::first_argument_type; + using second_argument_type = typename _Predicate::second_argument_type; + using result_type = bool; }; template diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h --- a/libcxx/include/__functional/bind.h +++ b/libcxx/include/__functional/bind.h @@ -264,10 +264,7 @@ } template -class __bind -#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public __weak_result_type::type> -#endif +class __bind : public __weak_result_type::type> { protected: typedef typename decay<_Fp>::type _Fd; diff --git a/libcxx/include/__functional/binder1st.h b/libcxx/include/__functional/binder1st.h --- a/libcxx/include/__functional/binder1st.h +++ b/libcxx/include/__functional/binder1st.h @@ -23,8 +23,9 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st - : public unary_function + : public __unary_function_or_empty, + typename __Operation::second_argument_type, + typename __Operation::result_type> { protected: __Operation op; diff --git a/libcxx/include/__functional/binder2nd.h b/libcxx/include/__functional/binder2nd.h --- a/libcxx/include/__functional/binder2nd.h +++ b/libcxx/include/__functional/binder2nd.h @@ -23,8 +23,9 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd - : public unary_function + : public __unary_function_or_empty, + typename __Operation::first_argument_type, + typename __Operation::result_type> { protected: __Operation op; diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -82,7 +82,7 @@ template struct __maybe_derive_from_unary_function<_Rp(_A1)> - : public unary_function<_A1, _Rp> + : public __unary_function_or_empty<__maybe_derive_from_unary_function<_Rp(_A1)>, _A1, _Rp> { }; @@ -93,7 +93,7 @@ template struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> + : public __binary_function_or_empty<__maybe_derive_from_binary_function<_Rp(_A1, _A2)>, _A1, _A2, _Rp> { }; @@ -953,10 +953,8 @@ template 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; diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h --- a/libcxx/include/__functional/hash.h +++ b/libcxx/include/__functional/hash.h @@ -268,15 +268,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct __scalar_hash<_Tp, 0> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp>, _Tp, size_t> { _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 { @@ -291,18 +285,10 @@ } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct __scalar_hash<_Tp, 1> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp, 1>, _Tp, size_t> { -_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 { @@ -316,18 +302,10 @@ } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct __scalar_hash<_Tp, 2> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp, 2>, _Tp, size_t> { -_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 { @@ -345,18 +323,10 @@ } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct __scalar_hash<_Tp, 3> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp, 3>, _Tp, size_t> { -_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 { @@ -375,18 +345,10 @@ } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct __scalar_hash<_Tp, 4> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp, 4>, _Tp, size_t> { -_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 { @@ -421,15 +383,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp*, size_t> -#endif + : public __unary_function_or_empty<__scalar_hash<_Tp*>, _Tp*, size_t> { _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 { @@ -446,15 +402,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, bool, size_t> { _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(__v);} }; @@ -462,15 +412,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, char, size_t> { _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(__v);} }; @@ -478,15 +422,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, signed char, size_t> { _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(__v);} }; @@ -494,15 +432,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, unsigned char, size_t> { _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(__v);} }; @@ -511,15 +443,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, char8_t, size_t> { _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(__v);} }; @@ -530,15 +456,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, char16_t, size_t> { _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(__v);} }; @@ -546,15 +466,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, char32_t, size_t> { _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(__v);} }; @@ -565,15 +479,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, wchar_t, size_t> { _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(__v);} }; @@ -582,15 +490,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, short, size_t> { _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(__v);} }; @@ -598,15 +500,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, unsigned short, size_t> { _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(__v);} }; @@ -614,15 +510,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, int, size_t> { _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(__v);} }; @@ -630,15 +520,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, unsigned int, size_t> { _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(__v);} }; @@ -646,15 +530,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, long, size_t> { _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(__v);} }; @@ -662,15 +540,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, unsigned long, size_t> { _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(__v);} }; @@ -784,15 +656,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template ::value> struct _LIBCPP_TEMPLATE_VIS __enum_hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function<_Tp, size_t> -#endif + : public __unary_function_or_empty<__enum_hash<_Tp>, _Tp, size_t> { _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 { @@ -817,15 +683,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <> struct _LIBCPP_TEMPLATE_VIS hash -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public unary_function -#endif + : public __unary_function_or_empty, nullptr_t, size_t> { _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; diff --git a/libcxx/include/__functional/mem_fn.h b/libcxx/include/__functional/mem_fn.h --- a/libcxx/include/__functional/mem_fn.h +++ b/libcxx/include/__functional/mem_fn.h @@ -24,10 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -class __mem_fn -#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public __weak_result_type<_Tp> -#endif +class __mem_fn : public __weak_result_type<_Tp> { public: // types @@ -43,7 +40,11 @@ // invoke template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +#if _LIBCPP_STD_VER > 14 + typename invoke_result::type +#else typename __invoke_return::type +#endif operator() (_ArgTypes&&... __args) const { return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); } diff --git a/libcxx/include/__functional/mem_fun_ref.h b/libcxx/include/__functional/mem_fun_ref.h --- a/libcxx/include/__functional/mem_fun_ref.h +++ b/libcxx/include/__functional/mem_fun_ref.h @@ -24,7 +24,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t - : public unary_function<_Tp*, _Sp> + : public __unary_function_or_empty, _Tp*, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -36,7 +36,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t - : public binary_function<_Tp*, _Ap, _Sp> + : public __binary_function_or_empty, _Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -60,7 +60,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t - : public unary_function<_Tp, _Sp> + : public __unary_function_or_empty, _Tp, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -72,7 +72,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t - : public binary_function<_Tp, _Ap, _Sp> + : public __binary_function_or_empty, _Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -96,7 +96,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t - : public unary_function + : public __unary_function_or_empty, const _Tp*, _Sp> { _Sp (_Tp::*__p_)() const; public: @@ -108,7 +108,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t - : public binary_function + : public __binary_function_or_empty, const _Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: @@ -132,7 +132,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t - : public unary_function<_Tp, _Sp> + : public __unary_function_or_empty, _Tp, _Sp> { _Sp (_Tp::*__p_)() const; public: @@ -144,7 +144,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t - : public binary_function<_Tp, _Ap, _Sp> + : public __binary_function_or_empty, _Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: diff --git a/libcxx/include/__functional/operations.h b/libcxx/include/__functional/operations.h --- a/libcxx/include/__functional/operations.h +++ b/libcxx/include/__functional/operations.h @@ -30,17 +30,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS plus -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -67,17 +60,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS minus -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -104,17 +90,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS multiplies -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -141,17 +120,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS divides -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -178,17 +150,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS modulus -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -215,16 +180,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS negate -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : unary_function<_Tp, _Tp> -#endif + : __unary_function_or_empty, _Tp, _Tp> { _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;} @@ -253,17 +212,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS bit_and -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -287,15 +239,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct _LIBCPP_TEMPLATE_VIS bit_not -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : unary_function<_Tp, _Tp> -#endif + : __unary_function_or_empty, _Tp, _Tp> { _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;} @@ -321,17 +267,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS bit_or -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -358,17 +297,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS bit_xor -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, _Tp> -#endif + : __binary_function_or_empty, _Tp, _Tp, _Tp> { _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;} @@ -397,17 +329,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS equal_to -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -434,17 +359,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS not_equal_to -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -471,17 +389,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS less -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -508,17 +419,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS less_equal -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -545,17 +449,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS greater_equal -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -582,17 +479,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS greater -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -621,17 +511,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS logical_and -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} @@ -658,16 +541,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS logical_not -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : unary_function<_Tp, bool> -#endif + : __unary_function_or_empty, _Tp, bool> { _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;} @@ -694,17 +571,10 @@ template #endif struct _LIBCPP_TEMPLATE_VIS logical_or -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function<_Tp, _Tp, bool> -#endif + : __binary_function_or_empty, _Tp, _Tp, bool> { _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;} diff --git a/libcxx/include/__functional/pointer_to_binary_function.h b/libcxx/include/__functional/pointer_to_binary_function.h --- a/libcxx/include/__functional/pointer_to_binary_function.h +++ b/libcxx/include/__functional/pointer_to_binary_function.h @@ -23,7 +23,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function - : public binary_function<_Arg1, _Arg2, _Result> + : public __binary_function_or_empty, _Arg1, _Arg2, _Result> { _Result (*__f_)(_Arg1, _Arg2); public: diff --git a/libcxx/include/__functional/pointer_to_unary_function.h b/libcxx/include/__functional/pointer_to_unary_function.h --- a/libcxx/include/__functional/pointer_to_unary_function.h +++ b/libcxx/include/__functional/pointer_to_unary_function.h @@ -23,7 +23,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function - : public unary_function<_Arg, _Result> + : public __unary_function_or_empty, _Arg, _Result> { _Result (*__f_)(_Arg); public: diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h --- a/libcxx/include/__functional/reference_wrapper.h +++ b/libcxx/include/__functional/reference_wrapper.h @@ -23,10 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -class _LIBCPP_TEMPLATE_VIS reference_wrapper -#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : public __weak_result_type<_Tp> -#endif +class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> { public: // types diff --git a/libcxx/include/__functional/unary_function.h b/libcxx/include/__functional/unary_function.h --- a/libcxx/include/__functional/unary_function.h +++ b/libcxx/include/__functional/unary_function.h @@ -17,13 +17,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) + template -struct _LIBCPP_TEMPLATE_VIS unary_function +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function { typedef _Arg argument_type; typedef _Result result_type; }; +#endif // _LIBCPP_STD_VER <= 14 + +template struct __unary_function_ebo_base { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg; + using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; +#endif +}; +template struct __unary_function_keep_layout_base { +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg; + using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; +#endif +}; + +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) +template +using __unary_function_or_empty = unary_function<_Arg, _Result>; +#elif defined(_LIBCPP_ABI_NO_BINDER_BASES) +template +using __unary_function_or_empty = __unary_function_ebo_base<_Derived, _Arg, _Result>; +#else +template +using __unary_function_or_empty = __unary_function_keep_layout_base<_Arg, _Result>; +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H diff --git a/libcxx/include/__functional/unary_negate.h b/libcxx/include/__functional/unary_negate.h --- a/libcxx/include/__functional/unary_negate.h +++ b/libcxx/include/__functional/unary_negate.h @@ -23,7 +23,7 @@ template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate - : public unary_function + : public __unary_function_or_empty, typename _Predicate::argument_type, bool> { _Predicate __pred_; public: @@ -33,6 +33,9 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const typename _Predicate::argument_type& __x) const {return !__pred_(__x);} + + using argument_type = typename _Predicate::argument_type; + using result_type = bool; }; template diff --git a/libcxx/include/__functional/weak_result_type.h b/libcxx/include/__functional/weak_result_type.h --- a/libcxx/include/__functional/weak_result_type.h +++ b/libcxx/include/__functional/weak_result_type.h @@ -40,9 +40,12 @@ private: struct __two {char __lx; char __lxx;}; static __two __test(...); +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template - static unary_function<_Ap, _Rp> - __test(const volatile unary_function<_Ap, _Rp>*); + static __unary_function_or_empty<__derives_from_unary_function<_Tp>, _Ap, _Rp> + __test(const volatile __unary_function_or_empty<__derives_from_unary_function<_Tp>, _Ap, _Rp>*); +_LIBCPP_DIAGNOSTIC_POP public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -54,9 +57,12 @@ private: struct __two {char __lx; char __lxx;}; static __two __test(...); +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template - static binary_function<_A1, _A2, _Rp> - __test(const volatile binary_function<_A1, _A2, _Rp>*); + static __binary_function_or_empty<__derives_from_binary_function<_Tp>, _A1, _A2, _Rp> + __test(const volatile __binary_function_or_empty<__derives_from_binary_function<_Tp>, _A1, _A2, _Rp>*); +_LIBCPP_DIAGNOSTIC_POP public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -89,7 +95,9 @@ : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> { - typedef _LIBCPP_NODEBUG typename _Tp::result_type result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type; +#endif }; template @@ -110,62 +118,68 @@ template struct __weak_result_type<_Rp ()> { - typedef _LIBCPP_NODEBUG _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (&)()> { - typedef _LIBCPP_NODEBUG _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (*)()> { - typedef _LIBCPP_NODEBUG _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; // 1 argument case template struct __weak_result_type<_Rp (_A1)> - : public unary_function<_A1, _Rp> + : public __unary_function_or_empty<__weak_result_type<_Rp(_A1)>, _A1, _Rp> { }; template struct __weak_result_type<_Rp (&)(_A1)> - : public unary_function<_A1, _Rp> + : public __unary_function_or_empty<__weak_result_type<_Rp(&)(_A1)>, _A1, _Rp> { }; template struct __weak_result_type<_Rp (*)(_A1)> - : public unary_function<_A1, _Rp> + : public __unary_function_or_empty<__weak_result_type<_Rp(*)(_A1)>, _A1, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)()> - : public unary_function<_Cp*, _Rp> + : public __unary_function_or_empty<__weak_result_type<_Rp(_Cp::*)()>, _Cp*, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)() const> - : public unary_function + : public __unary_function_or_empty<__weak_result_type<_Rp(_Cp::*)() const>, const _Cp*, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)() volatile> - : public unary_function + : public __unary_function_or_empty<__weak_result_type<_Rp(_Cp::*)() volatile>, volatile _Cp*, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)() const volatile> - : public unary_function + : public __unary_function_or_empty<__weak_result_type<_Rp(_Cp::*)() const volatile>, const volatile _Cp*, _Rp> { }; @@ -173,43 +187,44 @@ template struct __weak_result_type<_Rp (_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> + : public __binary_function_or_empty<__weak_result_type<_Rp(_A1, _A2)>, _A1, _A2, _Rp> { }; template struct __weak_result_type<_Rp (*)(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> + : public __binary_function_or_empty<__weak_result_type<_Rp(*)(_A1, _A2)>, _A1, _A2, _Rp> { }; template struct __weak_result_type<_Rp (&)(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> + : public __binary_function_or_empty<__weak_result_type<_Rp(&)(_A1, _A2)>, _A1, _A2, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)(_A1)> - : public binary_function<_Cp*, _A1, _Rp> + : public __binary_function_or_empty<__weak_result_type<_Rp(_Cp::*)(_A1)>, _Cp*, _A1, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)(_A1) const> - : public binary_function + : public __binary_function_or_empty<__weak_result_type<_Rp(_Cp::*)(_A1)> const, const _Cp*, _A1, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> - : public binary_function + : public __binary_function_or_empty<__weak_result_type<_Rp(_Cp::*)(_A1) volatile>, volatile _Cp*, _A1, _Rp> { }; template struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> - : public binary_function + : public __binary_function_or_empty<__weak_result_type<_Rp(_Cp::*)(_A1) const volatile>, + const volatile _Cp*, _A1, _Rp> { }; @@ -220,43 +235,57 @@ template struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> { - typedef _Rp result_type; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) + using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; +#endif }; template diff --git a/libcxx/include/__memory/auto_ptr.h b/libcxx/include/__memory/auto_ptr.h --- a/libcxx/include/__memory/auto_ptr.h +++ b/libcxx/include/__memory/auto_ptr.h @@ -16,6 +16,8 @@ # pragma GCC system_header #endif +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -77,4 +79,6 @@ _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) + #endif // _LIBCPP___MEMORY_AUTO_PTR_H diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -20,6 +20,7 @@ #include <__memory/allocation_guard.h> #include <__memory/allocator.h> #include <__memory/allocator_traits.h> +#include <__memory/auto_ptr.h> #include <__memory/compressed_pair.h> #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> @@ -38,9 +39,6 @@ # include #endif -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) -# include <__memory/auto_ptr.h> -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -1656,16 +1654,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct _LIBCPP_TEMPLATE_VIS owner_less > -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function, shared_ptr<_Tp>, bool> -#endif + : __binary_function_or_empty >, shared_ptr<_Tp>, shared_ptr<_Tp>, bool> { _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);} @@ -1680,16 +1671,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH template struct _LIBCPP_TEMPLATE_VIS owner_less > -#if !defined(_LIBCPP_ABI_NO_BINDER_BASES) - : binary_function, weak_ptr<_Tp>, bool> -#endif + : __binary_function_or_empty >, weak_ptr<_Tp>, weak_ptr<_Tp>, bool> { _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);} @@ -1765,11 +1749,6 @@ template struct _LIBCPP_TEMPLATE_VIS hash > { -#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 size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT { diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h --- a/libcxx/include/__memory/unique_ptr.h +++ b/libcxx/include/__memory/unique_ptr.h @@ -14,16 +14,13 @@ #include <__functional/hash.h> #include <__functional/operations.h> #include <__memory/allocator_traits.h> // __pointer +#include <__memory/auto_ptr.h> #include <__memory/compressed_pair.h> #include <__utility/forward.h> #include <__utility/move.h> #include #include -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) -# include <__memory/auto_ptr.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -742,11 +739,6 @@ unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> > #endif { -#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 size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const { diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -1085,14 +1085,20 @@ return __r; } +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template struct _LIBCPP_TEMPLATE_VIS hash > - : public unary_function, size_t> + : public __unary_function_or_empty >, bitset<_Size>, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT {return __bs.__hash_code();} + + using argument_type = bitset<_Size>; + using result_type = size_t; }; +_LIBCPP_DIAGNOSTIC_POP template basic_istream<_CharT, _Traits>& diff --git a/libcxx/include/ext/__hash b/libcxx/include/ext/__hash --- a/libcxx/include/ext/__hash +++ b/libcxx/include/ext/__hash @@ -22,7 +22,7 @@ template struct _LIBCPP_TEMPLATE_VIS hash { }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, const char*, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const char *__c) const _NOEXCEPT @@ -32,7 +32,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, char*, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(char *__c) const _NOEXCEPT @@ -42,7 +42,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, char, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(char __c) const _NOEXCEPT @@ -52,7 +52,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, signed char, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(signed char __c) const _NOEXCEPT @@ -62,7 +62,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, unsigned char, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned char __c) const _NOEXCEPT @@ -72,7 +72,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, short, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(short __c) const _NOEXCEPT @@ -82,7 +82,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, unsigned short, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned short __c) const _NOEXCEPT @@ -92,7 +92,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, int, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(int __c) const _NOEXCEPT @@ -102,7 +102,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, unsigned int, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned int __c) const _NOEXCEPT @@ -112,7 +112,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, long, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(long __c) const _NOEXCEPT @@ -122,7 +122,7 @@ }; template <> struct _LIBCPP_TEMPLATE_VIS hash - : public std::unary_function + : public std::__unary_function_or_empty, unsigned long, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned long __c) const _NOEXCEPT diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -968,9 +968,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH class _LIBCPP_TEMPLATE_VIS value_compare -#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) - : public binary_function -#endif + : public __binary_function_or_empty { _LIBCPP_SUPPRESS_DEPRECATED_POP friend class map; @@ -979,11 +977,6 @@ _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);} @@ -1753,9 +1746,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH class _LIBCPP_TEMPLATE_VIS value_compare -#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) - : public binary_function -#endif + : public __binary_function_or_empty { _LIBCPP_SUPPRESS_DEPRECATED_POP friend class multimap; @@ -1765,11 +1756,6 @@ _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/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -847,6 +847,7 @@ #include <__memory/allocator_arg_t.h> #include <__memory/allocator_traits.h> #include <__memory/assume_aligned.h> +#include <__memory/auto_ptr.h> #include <__memory/compressed_pair.h> #include <__memory/concepts.h> #include <__memory/construct_at.h> @@ -880,10 +881,6 @@ #include <__functional/unary_function.h> #include <__functional/weak_result_type.h> -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) -# include <__memory/auto_ptr.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/include/optional b/libcxx/include/optional --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -1560,11 +1560,6 @@ __enable_hash_helper, remove_const_t<_Tp>> > { -#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 size_t operator()(const optional<_Tp>& __opt) const { diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -4378,16 +4378,19 @@ const typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::npos; +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template struct _LIBCPP_TEMPLATE_VIS hash, _Allocator> > - : public unary_function< - basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> + : public __unary_function_or_empty, _Allocator> >, + basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> { size_t operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT { return __do_string_hash(__val.data(), __val.data() + __val.size()); } }; +_LIBCPP_DIAGNOSTIC_POP template diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -908,15 +908,19 @@ basic_string_view<_CharT, _Traits> __str); // [string.view.hash] +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template struct _LIBCPP_TEMPLATE_VIS hash > > - : public unary_function >, size_t> + : public __unary_function_or_empty > >, + basic_string_view<_CharT, char_traits<_CharT> >, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT { return __do_string_hash(__val.data(), __val.data() + __val.size()); } }; +_LIBCPP_DIAGNOSTIC_POP #if _LIBCPP_STD_VER > 11 diff --git a/libcxx/include/system_error b/libcxx/include/system_error --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -433,9 +433,11 @@ operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT {return !(__x == __y);} +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template <> struct _LIBCPP_TEMPLATE_VIS hash - : public unary_function + : public __unary_function_or_empty, error_code, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const error_code& __ec) const _NOEXCEPT @@ -443,10 +445,13 @@ return static_cast(__ec.value()); } }; +_LIBCPP_DIAGNOSTIC_POP +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template <> struct _LIBCPP_TEMPLATE_VIS hash - : public unary_function + : public __unary_function_or_empty, error_condition, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const error_condition& __ec) const _NOEXCEPT @@ -454,6 +459,7 @@ return static_cast(__ec.value()); } }; +_LIBCPP_DIAGNOSTIC_POP // system_error diff --git a/libcxx/include/thread b/libcxx/include/thread --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -196,9 +196,11 @@ __libcpp_tls_set(__key_, __p); } +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template<> struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> - : public unary_function<__thread_id, size_t> + : public __unary_function_or_empty, __thread_id, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(__thread_id __v) const _NOEXCEPT @@ -206,6 +208,7 @@ return hash<__libcpp_thread_id>()(__v.__id_); } }; +_LIBCPP_DIAGNOSTIC_POP template _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex --- a/libcxx/include/typeindex +++ b/libcxx/include/typeindex @@ -101,14 +101,17 @@ template struct _LIBCPP_TEMPLATE_VIS hash; +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template <> struct _LIBCPP_TEMPLATE_VIS hash - : public unary_function + : public __unary_function_or_empty, type_index, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(type_index __index) const _NOEXCEPT {return __index.hash_code();} }; +_LIBCPP_DIAGNOSTIC_POP _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -3224,14 +3224,17 @@ return __h; } +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template struct _LIBCPP_TEMPLATE_VIS hash > - : public unary_function, size_t> + : public __unary_function_or_empty >, vector, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const vector& __vec) const _NOEXCEPT {return __vec.__hash_code();} }; +_LIBCPP_DIAGNOSTIC_POP template inline _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp --- a/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp +++ b/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp @@ -6,7 +6,9 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: c++03 || c++11 || c++14 || c++17 +// REQUIRES: c++03 || c++11 || c++14 + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // diff --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp --- a/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp +++ b/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp @@ -6,7 +6,9 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: c++03 || c++11 || c++14 || c++17 +// REQUIRES: c++03 || c++11 || c++14 + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -29,8 +29,10 @@ { typedef std::vector T; typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; @@ -42,8 +44,10 @@ { typedef std::vector> T; typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); diff --git a/libcxx/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp b/libcxx/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp --- a/libcxx/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp +++ b/libcxx/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp @@ -10,6 +10,8 @@ // REQUIRES: c++03 || c++11 || c++14 // binary_function was removed in C++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + // template // struct binary_function // { diff --git a/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp b/libcxx/test/std/depr/depr.function.objects/depr.base/depr.verify.cpp copy from libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp copy to libcxx/test/std/depr/depr.function.objects/depr.base/depr.verify.cpp --- a/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp +++ b/libcxx/test/std/depr/depr.function.objects/depr.base/depr.verify.cpp @@ -7,21 +7,12 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++03 || c++11 || c++14 -// unary_function was removed in C++17 +// REQUIRES: c++11 || c++14 +// binary_function was removed in C++17 -// unary_function +// check that binary_function is marked deprecated #include -#include -#include "test_macros.h" - -int main(int, char**) -{ - typedef std::unary_function uf; - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - - return 0; -} +std::unary_function u; // expected-warning {{'unary_function' is deprecated}} +std::binary_function b; // expected-warning {{'binary_function' is deprecated}} diff --git a/libcxx/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp b/libcxx/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp --- a/libcxx/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp +++ b/libcxx/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp @@ -10,6 +10,8 @@ // REQUIRES: c++03 || c++11 || c++14 // unary_function was removed in C++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + // template // struct unary_function // { diff --git a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp --- a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp +++ b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp @@ -26,8 +26,10 @@ { typedef std::error_code T; typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); diff --git a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp --- a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp +++ b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp @@ -10,7 +10,6 @@ // template // struct hash -// : public unary_function // { // size_t operator()(T val) const; // }; @@ -26,8 +25,6 @@ { typedef std::error_condition T; typedef std::hash H; - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); diff --git a/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp b/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp --- a/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp +++ b/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp @@ -28,8 +28,10 @@ test() { typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(T())); H h; diff --git a/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp --- a/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp @@ -31,8 +31,10 @@ test() { typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif typedef typename SV::value_type char_type; typedef std::basic_string String; diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp --- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -29,8 +29,10 @@ std::thread::id id1; std::thread::id id2 = std::this_thread::get_id(); typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(id2)); H h; assert(h(id1) != h(id2)); diff --git a/libcxx/test/std/utilities/function.objects/func.require/binary_function.pass.cpp b/libcxx/test/std/utilities/function.objects/func.require/binary_function.pass.cpp --- a/libcxx/test/std/utilities/function.objects/func.require/binary_function.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/func.require/binary_function.pass.cpp @@ -10,6 +10,8 @@ // REQUIRES: c++03 || c++11 || c++14 // binary_function was removed in C++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + // binary_function #include diff --git a/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp b/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp --- a/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/func.require/unary_function.pass.cpp @@ -10,6 +10,8 @@ // REQUIRES: c++03 || c++11 || c++14 // unary_function was removed in C++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + // unary_function #include diff --git a/libcxx/test/std/utilities/function.objects/refwrap/binder_typedefs.compile.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/binder_typedefs.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/refwrap/binder_typedefs.compile.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++03 || c++11 || c++14 || c++17 + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + +// + +// reference_wrapper + +// check that binder typedefs exit + +#include +#include + +struct UnaryFunction +{ + typedef long argument_type; + typedef char result_type; +}; + +struct BinaryFunction +{ + typedef int first_argument_type; + typedef char second_argument_type; + typedef long result_type; +}; + +static_assert(std::is_same::result_type, int>::value); +static_assert(std::is_same::argument_type, UnaryFunction*>::value); + +static_assert(std::is_same::result_type, int>::value); +static_assert(std::is_same::first_argument_type, BinaryFunction*>::value); +static_assert(std::is_same::second_argument_type, char>::value); + +static_assert(std::is_same::result_type, void>::value); diff --git a/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp --- a/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp @@ -27,8 +27,10 @@ { typedef std::bitset T; typedef std::hash H; +#if TEST_STD_VER <= 14 static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif ASSERT_NOEXCEPT(H()(T())); H h; diff --git a/libcxx/test/std/utilities/type.index/type.index.hash/hash.pass.cpp b/libcxx/test/std/utilities/type.index/type.index.hash/hash.pass.cpp --- a/libcxx/test/std/utilities/type.index/type.index.hash/hash.pass.cpp +++ b/libcxx/test/std/utilities/type.index/type.index.hash/hash.pass.cpp @@ -27,9 +27,11 @@ int main(int, char**) { +#if TEST_STD_VER <= 14 typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif std::type_index t1 = typeid(int); assert(std::hash()(t1) == t1.hash_code()); diff --git a/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp b/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp --- a/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp +++ b/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp @@ -27,9 +27,11 @@ int main(int, char**) { { +#if TEST_STD_VER <= 14 typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); +#endif } #if TEST_STD_VER >= 11 {