From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B47238A8867; Mon, 9 Aug 2021 19:56:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B47238A8867 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60372] [DR1880] incorrect destruction order for function parameter objects Date: Mon, 09 Aug 2021 19:56:38 +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: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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_status resolution 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: Mon, 09 Aug 2021 19:56:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60372 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|SUSPENDED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski --- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1880 Section: 7.6.1.3 [expr.call] Status: CD4 Submitter: Hubert Tong=20= =20=20=20 Date: 2014-02-25 [Adopted at the June, 2016 meeting as part of paper P0135R1.] According to 7.6.1.3 [expr.call] paragraph 4, The lifetime of a parameter ends when the function in which it is defined returns. The initialization and destruction of each parameter occurs within= the context of the calling function. This presumably means that the destruction of the parameter object occurs before the end of the full-expression, unlike temporaries. This is not what current implementations do, however. It is not clear that a change to treat parameter objects like temporaries, to match existing practice, would be an improvement, however, as it would result in ABI breakage for implementations that destroy parameters in the called function. See also issue 1935 for a related question regarding the handling of argume= nts to a placement allocation function and placement deallocation function. Notes from the June, 2014 meeting: WG decided to make it ****unspecified**** whether parameter objects are destroyed immediately following the call or ****at the end of the full-expression to which the call belongs***. This approach also resolves i= ssue 1935.=