Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr104051-0.C

raw
1 // { dg-additional-options "-fsyntax-only" }
2 // { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } }
3 #include <coroutine>
4 #include <vector>
5 template <typename> struct promise {
6 struct final_awaitable {
7 bool await_ready() noexcept;
8 template <typename Promise>
9 std::coroutine_handle<>
10 await_suspend(std::coroutine_handle<Promise>) noexcept;
11 void await_resume() noexcept;
12 };
13 auto get_return_object() {
14 return std::coroutine_handle<promise>::from_promise(*this);
15 }
16 auto initial_suspend() { return std::suspend_always(); }
17 auto final_suspend() noexcept { return true; }
18 void unhandled_exception();
19 };
20 template <typename T> struct task {
21 using promise_type = promise<T>;
22 task(std::coroutine_handle<promise<T>>);
23 bool await_ready();
24 std::coroutine_handle<> await_suspend(std::coroutine_handle<>);
25 T await_resume();
26 };
27 task<std::vector<int>> foo() {
28 while ((co_await foo()).empty())
29 ;
30 } // { dg-error {'final_suspend\(\)' awaitable type 'bool' is not a structure} }