xref: /llvm-project/clang/test/SemaCXX/Inputs/std-coroutine.h (revision 0b8daee028a87ab8a6f8fe54d2eb2d5b5c2babd4)
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-value
2 #ifndef STD_COROUTINE_H
3 #define STD_COROUTINE_H
4 
5 namespace std {
6 
7 template<typename T> struct remove_reference       { typedef T type; };
8 template<typename T> struct remove_reference<T &>  { typedef T type; };
9 template<typename T> struct remove_reference<T &&> { typedef T type; };
10 
11 template<typename T>
12 typename remove_reference<T>::type &&move(T &&t) noexcept;
13 
14 struct input_iterator_tag {};
15 struct forward_iterator_tag : public input_iterator_tag {};
16 
17 template <class Ret, typename... T>
18 struct coroutine_traits { using promise_type = typename Ret::promise_type; };
19 
20 template <class Promise = void>
21 struct 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 };
26 template <>
27 struct 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 
34 struct suspend_always {
35   bool await_ready() noexcept { return false; }
36   void await_suspend(coroutine_handle<>) noexcept {}
37   void await_resume() noexcept {}
38 };
39 
40 struct 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 std
47 
48 #endif // STD_COROUTINE_H
49