Debian Codegraph @

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

raw
1 #include <coroutine>
2
3 struct task {
4 struct promise_type {
5 auto initial_suspend() noexcept { return std::suspend_always{}; }
6 auto final_suspend() noexcept { return std::suspend_always{}; }
7 void return_void() {}
8 task get_return_object() { return task{}; }
9 void unhandled_exception() noexcept {}
10 };
11
12 ~task() noexcept {}
13
14 bool await_ready() const noexcept { return false; }
15 void await_suspend(std::coroutine_handle<>) noexcept {}
16 void await_resume() noexcept {}
17 };
18
19 struct base
20 {
21 virtual ~base() = default;
22 };
23
24 class exception : public virtual base
25 {};
26
27 struct factory
28 {
29 virtual ~factory() = default;
30 virtual int makeId() const;
31 };
32
33 task g(int);
34
35 task f(factory& factory) {
36 co_await g(factory.makeId());
37 }