Debian Codegraph @

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

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