1 // Test this without pch.
2 // RUN: %clang_cc1 -include %s -verify -std=c++1z -fcoroutines-ts %s
5 // RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -emit-pch -o %t %s
6 // RUN: %clang_cc1 -include-pch %t -verify -std=c++1z -fcoroutines-ts %s
12 template <typename
... T
> struct coroutine_traits
;
14 template <class Promise
= void> struct coroutine_handle
{
15 coroutine_handle() = default;
16 static coroutine_handle
from_address(void *) noexcept
;
18 template <> struct coroutine_handle
<void> {
19 static coroutine_handle
from_address(void *) noexcept
;
20 coroutine_handle() = default;
21 template <class PromiseType
>
22 coroutine_handle(coroutine_handle
<PromiseType
>) noexcept
;
26 struct suspend_always
{
27 bool await_ready() noexcept
;
28 void await_suspend(std::coroutine_handle
<>) noexcept
;
29 void await_resume() noexcept
;
32 template <typename
... Args
> struct std::coroutine_traits
<void, Args
...> {
34 void get_return_object() noexcept
;
35 suspend_always
initial_suspend() noexcept
;
36 suspend_always
final_suspend() noexcept
;
37 void return_void() noexcept
;
38 suspend_always
yield_value(int) noexcept
;
40 ~promise_type() noexcept
;
41 void unhandled_exception() noexcept
;
45 template <typename
... Args
> struct std::coroutine_traits
<int, Args
...> {
47 int get_return_object() noexcept
;
48 suspend_always
initial_suspend() noexcept
;
49 suspend_always
final_suspend() noexcept
;
50 void return_value(int) noexcept
;
52 ~promise_type() noexcept
;
53 void unhandled_exception() noexcept
;
58 void f(T x
) { // checks coawait_expr and coroutine_body_stmt
59 co_yield
42; // checks coyield_expr
60 co_await x
; // checks dependent_coawait
61 co_return
; // checks coreturn_stmt
65 int f2(T x
) { // checks coawait_expr and coroutine_body_stmt
66 co_return x
; // checks coreturn_stmt with expr
70 S
operator co_await(S
) { return S(); }
74 co_await x
; // checks dependent_coawait with overloaded co_await operator
79 // expected-no-diagnostics