summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/__config4
-rw-r--r--libcxx/include/experimental/coroutine10
2 files changed, 9 insertions, 5 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 4ad700e234c..32e542bd1fd 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1126,6 +1126,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_HAS_NO_IS_AGGREGATE
#endif
+#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
+# define _LIBCPP_HAS_NO_COROUTINES
+#endif
+
#endif // __cplusplus
// Decide whether to use availability macros.
diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine
index 161f95bde55..a2ac9937efb 100644
--- a/libcxx/include/experimental/coroutine
+++ b/libcxx/include/experimental/coroutine
@@ -59,7 +59,7 @@ template <class P> struct hash<coroutine_handle<P>>;
#pragma GCC system_header
#endif
-#ifndef __cpp_coroutines
+#ifdef _LIBCPP_HAS_NO_COROUTINES
# if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("<experimental/coroutine> cannot be used with this compiler")
# else
@@ -67,6 +67,8 @@ template <class P> struct hash<coroutine_handle<P>>;
# endif
#endif
+#ifndef _LIBCPP_HAS_NO_COROUTINES
+
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES
template <class _Tp, class = void>
@@ -88,8 +90,6 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_traits
template <typename _Promise = void>
class _LIBCPP_TEMPLATE_VIS coroutine_handle;
-#if defined(__cpp_coroutines)
-
template <>
class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
public:
@@ -235,8 +235,6 @@ struct _LIBCPP_TYPE_VIS suspend_always {
void await_resume() const noexcept {}
};
-#endif // defined(__cpp_coroutines)
-
_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -251,4 +249,6 @@ struct hash<_VSTD_CORO::coroutine_handle<_Tp> > {
_LIBCPP_END_NAMESPACE_STD
+#endif // !defined(_LIBCPP_HAS_NO_COROUTINES)
+
#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */
OpenPOWER on IntegriCloud