1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -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 | namespace experimental { |
7 | |
8 | template <class Ret, typename... T> |
9 | struct coroutine_traits { using promise_type = typename Ret::promise_type; }; |
10 | |
11 | template <class Promise = void> |
12 | struct coroutine_handle { |
13 | static coroutine_handle from_address(void *); |
14 | }; |
15 | template <> |
16 | struct coroutine_handle<void> { |
17 | template <class PromiseType> |
18 | coroutine_handle(coroutine_handle<PromiseType>); |
19 | static coroutine_handle from_address(void *); |
20 | }; |
21 | |
22 | struct suspend_always { |
23 | bool await_ready() { return false; } |
24 | void await_suspend(coroutine_handle<>) {} |
25 | void await_resume() {} |
26 | }; |
27 | |
28 | struct suspend_never { |
29 | bool await_ready() { return true; } |
30 | void await_suspend(coroutine_handle<>) {} |
31 | void await_resume() {} |
32 | }; |
33 | |
34 | } // namespace experimental |
35 | } // namespace std |
36 | |
37 | #endif // STD_COROUTINE_H |
38 | |