Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/torture/pr105104.C

raw
1 // https://gcc.gnu.org/PR105104
2 // { dg-additional-options "-O" }
3
4 #include <coroutine>
5
6 // ICE during GIMPLE pass: coro-early-expand-ifs. final_awaiter::await_resume is
7 // non-void, and optimizations are enabled.
8
9 struct return_object
10 {
11 struct promise_type
12 {
13 static constexpr std::suspend_always initial_suspend () noexcept
14 {
15 return {};
16 }
17
18 struct final_awaiter
19 {
20 static constexpr bool await_ready () noexcept { return false; }
21 static constexpr void await_suspend (std::coroutine_handle<>) noexcept {}
22 static constexpr int await_resume () noexcept { return {}; }
23 };
24 static constexpr final_awaiter final_suspend () noexcept { return {}; }
25
26 static void unhandled_exception () { throw; }
27
28 return_object get_return_object () { return {}; }
29
30 static constexpr void return_void () noexcept {}
31 };
32 };
33
34 return_object
35 coroutine ()
36 {
37 co_return;
38 }
39
40 return_object f = coroutine ();