From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A7FED3860C3A; Tue, 27 Oct 2020 05:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7FED3860C3A From: "jehelset at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97587] New: [coroutines] promise_type constructor is called with original parameters, not parameter copies Date: Tue, 27 Oct 2020 05:35:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jehelset at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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: Tue, 27 Oct 2020 05:35:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97587 Bug ID: 97587 Summary: [coroutines] promise_type constructor is called with original parameters, not parameter copies Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jehelset at gmail dot com Target Milestone: --- Created attachment 49443 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D49443&action=3Dedit Program that results in assertion-failure due to wrong arguments to promise. The promise-type constructor should be called with the parameter copies from the coroutine-frame. I couldn't quite understand that this is supposed to be the case from the current draft of the standard, but I got some help from L= ewis Baker who also referred me to this rewording, where in the previous version= it is clear:=20 https://github.com/cplusplus/draft/commit/0b4ab68a54e197eba9d894a8f91270bb0= dcdb546 The attached code triggers an assertion that show that this is not the case= on gcc. I initially had the problem on gcc-10.2.0, but reproduced it on gcc-tr= unk on godbolt. Compile either version with -fcoroutines, or see https://gcc.godbolt.org/z/j16Wqx. I speculated that the logic here, https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/coroutines.cc#L4491-L4= 494, was inverted. It seemed to pass the copied version of a by-reference parame= ter, but the original version of a by-value parameter. The opposite would not trigger the assertion. But I am not that familiar.=