Debian Codegraph @

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

raw
1 // { dg-additional-options "-fsyntax-only -w" }
2
3 // Diagnose bad coroutine awatiable type.
4
5 #include<coroutine>
6
7 struct coro{
8 struct not_a_template{};
9 using promise_type = coro;
10 static constexpr std::suspend_always initial_suspend()noexcept{ return {}; }
11 constexpr bool await_ready()noexcept{ return false; }
12 constexpr not_a_template await_suspend(std::coroutine_handle<>)noexcept{ return{}; }
13 constexpr void await_resume()noexcept{}
14 static coro body()
15 {
16 co_await coro{}; // { dg-error {'await_suspend' must return 'void', 'bool' or a coroutine handle} }
17 }
18 };