public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95346] [coroutines] coroutine return-type should be initialised with rvalue if different from get_return_object() return-type
Date: Thu, 04 Jun 2020 18:26:28 +0000	[thread overview]
Message-ID: <bug-95346-4-KNJ0qJSYQC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95346-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95346

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3

commit r11-952-g4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jun 4 17:14:37 2020 +0100

    coroutines: Fix missed ramp function return copy elision [PR95346].

    Confusingly, "get_return_object ()" can do two things:
    - Firstly it can provide the return object for the ramp function (as
      the name suggests).
    - Secondly if the type of the ramp function is different from that
      of the get_return_object call, this is used as a single parameter
      to a CTOR for the ramp's return type.

    In the first case we can rely on finish_return_stmt () to do the
    necessary processing for copy elision.
    In the second case, we should have passed a prvalue to the CTOR as
    per the standard comment, but I had omitted the rvalue () call.  Fixed
    thus.

    gcc/cp/ChangeLog:

            PR c++/95346
            * coroutines.cc (morph_fn_to_coro): Ensure that the get-
            return-object is constructed correctly; When it is not the
            final return value, pass it to the CTOR of the return type
            as an rvalue, per the standard comment.

    gcc/testsuite/ChangeLog:

            PR c++/95346
            * g++.dg/coroutines/pr95346.C: New test.

  parent reply	other threads:[~2020-06-04 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 20:31 [Bug c++/95346] New: " lewissbaker.opensource at gmail dot com
2020-05-27 19:42 ` [Bug c++/95346] " iains at gcc dot gnu.org
2020-06-04 18:26 ` cvs-commit at gcc dot gnu.org [this message]
2020-06-10 20:59 ` cvs-commit at gcc dot gnu.org
2020-06-12 17:55 ` iains at gcc dot gnu.org

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=bug-95346-4-KNJ0qJSYQC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).