49 lines · c
1// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++20 -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wno-unreachable-code -Wno-unused-value2#ifndef STD_COROUTINE_H3#define STD_COROUTINE_H4 5namespace std {6 7template<typename T> struct remove_reference { typedef T type; };8template<typename T> struct remove_reference<T &> { typedef T type; };9template<typename T> struct remove_reference<T &&> { typedef T type; };10 11template<typename T>12typename remove_reference<T>::type &&move(T &&t) noexcept;13 14struct input_iterator_tag {};15struct forward_iterator_tag : public input_iterator_tag {};16 17template <class Ret, typename... T>18struct coroutine_traits { using promise_type = typename Ret::promise_type; };19 20template <class Promise = void>21struct coroutine_handle {22 static coroutine_handle from_address(void *) noexcept;23 static coroutine_handle from_promise(Promise &promise);24 constexpr void* address() const noexcept;25};26template <>27struct coroutine_handle<void> {28 template <class PromiseType>29 coroutine_handle(coroutine_handle<PromiseType>) noexcept;30 static coroutine_handle from_address(void *);31 constexpr void* address() const noexcept;32};33 34struct suspend_always {35 bool await_ready() noexcept { return false; }36 void await_suspend(coroutine_handle<>) noexcept {}37 void await_resume() noexcept {}38};39 40struct suspend_never {41 bool await_ready() noexcept { return true; }42 void await_suspend(coroutine_handle<>) noexcept {}43 void await_resume() noexcept {}44};45 46} // namespace std47 48#endif // STD_COROUTINE_H49