[libc++] Properly mark std::function as deprecated in C++03
Due to Clang bug http://llvm.org/PR45151, deprecated attributes are not
picked up on partial specializations. This patch instead applies it to
the first declaration of std::function itself.
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: a13417352ade3bf2ef68cabcde1dc480746644ad
diff --git a/include/functional b/include/functional
index 865a281..63e3cbe 100644
--- a/include/functional
+++ b/include/functional
@@ -1434,7 +1434,14 @@
#endif
}
-template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
+#if defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && __has_attribute(deprecated)
+# define _LIBCPP_DEPRECATED_CXX03_FUNCTION \
+ __attribute__((deprecated("Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type")))
+#else
+# define _LIBCPP_DEPRECATED_CXX03_FUNCTION /* nothing */
+#endif
+
+template<class _Fp> class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function; // undefined
namespace __function
{