From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DCA83858433; Sun, 4 Feb 2024 20:53:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DCA83858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707080037; bh=+ngvK/tH6JTaj1JAdcMZpOmBtT7oXDgPv+GZzmeXGV8=; h=From:To:Subject:Date:From; b=pm10iJPuuzxuEp+rj+C7C1IEs8/QEkLzWJmF5j7E0oQX7YnvbWlcAaLvxdUIcbIjK yRQE8+VxVTQqw5ykk4CZmjyZxpT1KbOHFTWnioIUuYBcsPwg6GOZXkiNpoTLN7vACY dmZJsOEeohWqDb+Mc1AhAlBUQ477P5FgF23goUD8= From: "ibuclaw at gdcproject dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary Date: Sun, 04 Feb 2024 20:53:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ibuclaw at gdcproject dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113758 Bug ID: 113758 Summary: d: Callee destructor call invalidates the live object, not the temporary Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- D ABI does callee destruction of arguments, which depends on the argument already being copied to a temporary before passing by ref. At some point, the front-end stopped explicitly generating this temporary, = so now the code generator must take care of it. --- struct Sdtor { int field; ~this() { field =3D 0; } } void main() { auto var =3D Sdtor(1); callee(var); assert(var.field =3D=3D 1); // fails. } void callee(Sdtor param) { }=