Clang Project

clang_source_code/test/AST/Inputs/std-coroutine.h
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
5namespace std {
6namespace experimental {
7
8template <class Ret, typename... T>
9struct coroutine_traits { using promise_type = typename Ret::promise_type; };
10
11template <class Promise = void>
12struct coroutine_handle {
13  static coroutine_handle from_address(void *);
14};
15template <>
16struct coroutine_handle<void> {
17  template <class PromiseType>
18  coroutine_handle(coroutine_handle<PromiseType>);
19  static coroutine_handle from_address(void *);
20};
21
22struct suspend_always {
23  bool await_ready() { return false; }
24  void await_suspend(coroutine_handle<>) {}
25  void await_resume() {}
26};
27
28struct 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