From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7D957383E808; Wed, 10 Jun 2020 20:59:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D957383E808 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591822745; bh=PCH0RO7V5Qzm9WNsvlK0b8fX1v/bbS8xwlijbRchifc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fD0hxfjMtmv16ADfQ41xyZhmkA5aRVhO30+QxLc+XVJP/ERfnt/PBgQj6x5oMJIfb e7WFUX9NHtXED2Jh/1F16Z37Gf0Y0kfVzz66mhRYKiSf+IF8bADNbBW8UAvC88QWrC 83lExzyrGXo9fngk+gXiJtPzlRD7fsLovXeqQwHQ= From: "cvs-commit at gcc dot 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: Wed, 10 Jun 2020 20:59:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: iains at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2020 20:59:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95346 --- Comment #3 from CVS Commits --- The releases/gcc-10 branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:5bb75908cbcc0d2ddfbadedfcd716b33694fd9c4 commit r10-8269-g5bb75908cbcc0d2ddfbadedfcd716b33694fd9c4 Author: Iain Sandoe Date: Wed Jun 10 08:12:32 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. (cherry picked from commit 4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3)=