1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -fsyntax-only -Wall -Wextra -Wuninitialized  -fblocks
2 #include "Inputs/std-coroutine.h"
3 
4 using namespace std::experimental;
5 
6 
7 struct A {
await_readyA8   bool await_ready() { return true; }
await_resumeA9   int await_resume() { return 42; }
10   template <typename F>
await_suspendA11   void await_suspend(F) {}
12 };
13 
14 
15 struct coro_t {
16   struct promise_type {
get_return_objectcoro_t::promise_type17     coro_t get_return_object() { return {}; }
initial_suspendcoro_t::promise_type18     suspend_never initial_suspend() { return {}; }
final_suspendcoro_t::promise_type19     suspend_never final_suspend() { return {}; }
yield_valuecoro_t::promise_type20     A yield_value(int) { return {}; }
return_voidcoro_t::promise_type21     void return_void() {}
unhandled_exceptioncoro_t::promise_type22     static void unhandled_exception() {}
23   };
24 };
25 
f(int n)26 coro_t f(int n) {
27   if (n == 0)
28     co_return;
29   co_yield 42;
30   int x = co_await A{};
31 }
32 
33 template <class Await>
g(int n)34 coro_t g(int n) {
35   if (n == 0)
36     co_return;
37   co_yield 42;
38   int x = co_await Await{};
39 }
40 
main()41 int main() {
42   f(0);
43   g<A>(0);
44 }
45