public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6044] coroutines, c++: Add test for PR 96517.
@ 2021-12-17 16:55 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2021-12-17 16:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:39d2ec41509e3b0d130215a65d7aacbd064b5532

commit r12-6044-g39d2ec41509e3b0d130215a65d7aacbd064b5532
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Oct 15 09:42:25 2021 +0100

    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.

Diff:
---
 gcc/testsuite/g++.dg/coroutines/pr96517.C | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr96517.C b/gcc/testsuite/g++.dg/coroutines/pr96517.C
new file mode 100644
index 00000000000..9cbac3ebc0d
--- /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() {}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-17 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 16:55 [gcc r12-6044] coroutines, c++: Add test for PR 96517 Iain D Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).