Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr94883-folly-2.C

raw
1
2 namespace std {
3 template <typename a, typename...> struct coroutine_traits : a {};
4 template <typename = void> struct coroutine_handle;
5 template <> struct coroutine_handle<> {
6 static coroutine_handle from_address(void*);
7 void* address();
8 };
9 template <typename> struct coroutine_handle : coroutine_handle<> {
10 static coroutine_handle from_address(void*);
11 void* address();
12 };
13 struct b {
14 bool await_ready();
15 void await_suspend(coroutine_handle<>);
16 void await_resume();
17 };
18 } // namespace std
19 class h;
20 template <typename, typename = int> class k {
21 public:
22 using promise_type = h;
23 using i = std::coroutine_handle<>;
24 class l {
25 public:
26 ~l();
27 operator bool();
28 };
29 class m {
30 public:
31 bool await_ready();
32 i await_suspend(std::coroutine_handle<>);
33 l await_resume();
34 };
35 class n {
36 public:
37 m e(int);
38 };
39 n ah();
40 };
41
42 template <typename ai, typename aj, typename ak>
43 k<aj>
44 my_coro (k<aj, ak> am, ai) {
45 if (auto an = co_await am.ah())
46 ;
47 }
48
49 template <typename d> auto ab(int ac, d ad) -> decltype(ad.e(ac));
50 int f;
51 class h {
52 class j {
53 public:
54 bool await_ready() noexcept;
55 void await_suspend(std::coroutine_handle<>) noexcept;
56 void await_resume() noexcept;
57 };
58
59 public:
60 k<int> get_return_object();
61 std::b initial_suspend();
62 j final_suspend() noexcept;
63 void unhandled_exception();
64 template <typename g>
65 auto await_transform (g c) { return ab(f, c); }
66 };
67
68 void foo () {
69 k<int> a;
70 my_coro (a, [] {});
71 }