[libc++] Don't try to include <Block.h> when not available
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: cd66970b371240d90e163d2020c1a42bb2b7e1b9
diff --git a/include/functional b/include/functional
index f03ba8b..360ca6e 100644
--- a/include/functional
+++ b/include/functional
@@ -508,7 +508,7 @@
#include <__functional_base>
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC)
+#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
#include <Block.h>
#endif
@@ -2255,7 +2255,7 @@
#endif // _LIBCPP_NO_RTTI
};
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC)
+#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>