or upgrade to C++11 or later. It is possible to re-enable ``std::function`` in C++03 by defining
``_LIBCPP_ENABLE_CXX03_FUNCTION``. This option will be removed in LLVM 16.
-- ``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 deprecation warnings.
+- ``unary_function`` and ``binary_function`` are now marked as ``[[deprecated]]`` in C++11 and later.
+ Deprecation warnings can be disabled by defining ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``, however
+ this disables all deprecation warnings, not only those for ``unary_function`` and ``binary_function``.
+ Also note that starting in LLVM 16, ``unary_function`` and ``binary_function`` will be removed entirely
+ (not only deprecated) in C++17 and above, as mandated by the Standard.
- The contents of ``<codecvt>``, ``wstring_convert`` and ``wbuffer_convert`` have been marked as deprecated.
To disable deprecation warnings you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
# endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
+// Leave the deprecation notices in by default, but don't remove unary_function and
+// binary_function entirely just yet. That way, folks will have one release to act
+// on the deprecation warnings.
+# ifndef _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+# endif
+
# if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION
#include <utility>
#include "test_macros.h"
+// This test is disabled in LLVM 15 because we enable the removed
+// unary_function and binary_function classes by default, which means
+// that we also don't produce deprecation warnings for using their members.
+
+// expected-no-diagnostics
+#if 0
void test_functional()
{
{
(void)c;
}
}
+#endif