Debian Codegraph @

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

raw
1 // { dg-additional-options "-fanalyzer" }
2 // { dg-excess-errors "lots of analyzer output, but no ICE" }
3 namespace std {
4 template <typename _Result> struct coroutine_traits : _Result {};
5 template <typename = void> struct coroutine_handle {
6 operator coroutine_handle<>();
7 static coroutine_handle from_address(void*);
8 void* address();
9 };
10 }
11 struct coro1 {
12 using handle_type = std::coroutine_handle<>;
13 coro1(handle_type);
14 struct suspend_always_prt {
15 bool await_ready() noexcept;
16 void await_suspend(handle_type) noexcept;
17 void await_resume() noexcept;
18 };
19 struct promise_type {
20 std::coroutine_handle<> ch_;
21 auto get_return_object() { return ch_; }
22 auto initial_suspend() { return suspend_always_prt{}; }
23 auto final_suspend() noexcept { return suspend_always_prt{}; }
24 void unhandled_exception();
25 };
26 };
27 struct BoolAwaiter {
28 BoolAwaiter(bool);
29 bool await_ready();
30 void await_suspend(std::coroutine_handle<>);
31 bool await_resume();
32 };
33 struct IntAwaiter {
34 IntAwaiter(int);
35 bool await_ready();
36 void await_suspend(std::coroutine_handle<>);
37 int await_resume();
38 };
39 coro1 my_coro() {
40 int a = 1;
41 if (a == 0) {
42 int b = 5;
43
44 }
45 {
46 int c = 10;
47 }
48 co_await BoolAwaiter(true) && co_await IntAwaiter(a);
49
50 }