summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/coroutines/pr105287.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/coroutines/pr105287.C')
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr105287.C48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/coroutines/pr105287.C b/gcc/testsuite/g++.dg/coroutines/pr105287.C
new file mode 100644
index 00000000000..9790945287d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr105287.C
@@ -0,0 +1,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);
+
+ }