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