Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr95591.C

raw
1 #if __has_include (<coroutine>)
2 #include <coroutine>
3 using namespace std;
4 #elif defined (__clang__) && __has_include (<experimental/coroutine>)
5 #include <experimental/coroutine>
6 namespace std { using namespace experimental; }
7 #endif
8
9 struct generator {
10 struct promise_type {
11 generator get_return_object();
12 void return_void();
13 void unhandled_exception();
14 suspend_always initial_suspend();
15 suspend_always final_suspend() noexcept;
16
17 template<typename Arg>
18 suspend_always yield_value(Arg&&) {
19 return {};
20 }
21 };
22 };
23
24 generator x() {
25 co_yield "foo";
26 }