aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-10-15 09:42:25 +0100
committerIain Sandoe <iain@sandoe.co.uk>2021-12-17 16:54:35 +0000
commit39d2ec41509e3b0d130215a65d7aacbd064b5532 (patch)
tree51d9c3eafb3a8347f82fb8638486492e46580076
parentdfedfc304ad2159acbff1d89e707e359e97353bf (diff)
downloadgcc-39d2ec41509e3b0d130215a65d7aacbd064b5532.zip
gcc-39d2ec41509e3b0d130215a65d7aacbd064b5532.tar.gz
gcc-39d2ec41509e3b0d130215a65d7aacbd064b5532.tar.bz2
coroutines, c++: Add test for PR 96517.
This PR was fixed by r12-5255-gdaa9c6b015, this adds the testcase. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/testsuite/ChangeLog: PR c++/96517 * g++.dg/coroutines/pr96517.C: New test.
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr96517.C29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/coroutines/pr96517.C b/gcc/testsuite/g++.dg/coroutines/pr96517.C
new file mode 100644
index 0000000..9cbac3e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr96517.C
@@ -0,0 +1,29 @@
+// { dg-additional-options " -O1 " }
+#include <coroutine>
+
+struct coroutine {
+ struct promise_type {
+ coroutine get_return_object() { return {}; }
+ void return_void() {}
+ void unhandled_exception() {}
+ auto initial_suspend() noexcept { return std::suspend_never{}; }
+ auto final_suspend() noexcept { return std::suspend_never{}; }
+ };
+};
+
+struct data {
+ constexpr int get() { return 5; }
+};
+
+struct test {
+ data _data;
+
+ void foo() {
+ [this]() -> coroutine {
+ _data.get();
+ co_return;
+ };
+ }
+};
+
+int main() {}