public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6044] coroutines, c++: Add test for PR 96517.
Date: Fri, 17 Dec 2021 16:55:02 +0000 (GMT)	[thread overview]
Message-ID: <20211217165502.A75653858407@sourceware.org> (raw)

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() {}


                 reply	other threads:[~2021-12-17 16:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211217165502.A75653858407@sourceware.org \
    --to=iains@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).