Debian Codegraph @

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

raw
1 #if __has_include(<coroutine>)
2 #include <coroutine>
3 #else
4 #include <experimental/coroutine>
5 namespace std { using namespace experimental; }
6 #endif
7 #if 0
8 struct suspend_n {
9 const int x;
10 constexpr suspend_n (int x) : x (x) {}
11 constexpr static bool await_ready() { return false; }
12 constexpr static void await_suspend(std::coroutine_handle<>) {}
13 constexpr static void await_resume() {}
14 };
15 #endif
16 struct task
17 {
18 struct promise_type
19 {
20 auto get_return_object() const { return task{}; }
21 #if 0
22 // static constexpr suspend_n initial_suspend() { return {2}; }
23 #endif
24 static constexpr std::suspend_always initial_suspend() { return {}; }
25 static constexpr std::suspend_never final_suspend() noexcept { return {}; }
26 static constexpr void return_void() {}
27 static constexpr void unhandled_exception() {}
28 };
29 };
30
31 task
32 test_task ()
33 {
34 co_await std::suspend_always{};
35 }
36
37 auto t = test_task();
38
39 int main() {}