# define _LIBCPP_HAS_EXTENSION_BLOCKS
#endif
+#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
+# define _LIBCPP_HAS_BLOCKS_RUNTIME
+#endif
+
#if !(__has_feature(cxx_relaxed_constexpr))
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#endif
#include <__functional_base>
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
+#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
#include <Block.h>
#endif
#endif // _LIBCPP_NO_RTTI
};
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
+#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
// std::function support for the "blocks" extension
// UNSUPPORTED: c++98, c++03
-// REQUIRES: has-fblocks
+
+// This test requires the Blocks runtime, which is (only?) available
+// on Darwin out-of-the-box.
+// REQUIRES: has-fblocks && darwin
// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -fblocks
// RUN: %{run}
-#if __has_include(<Block.h>)
-
#include <functional>
#include <cstdlib>
#include <cassert>
return 0;
}
-
-#else
-
-int main() { }
-
-#endif