From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B3B3E3853D7C; Sun, 4 Dec 2022 10:41:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3B3E3853D7C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670150467; bh=gJdE/bxk94TVD7e40MsPy2RtnBEh+/j9DWHobQHvmtg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=S//X0zV49bjrF/GN8IMO0dThcD65ODkSpWi28KvdbhYS7RFlZslLfIBHH1X+j4H56 Dn4UIUZhtqUmOhEqapk8avvsRtLZMdL4qL3sza4m5UqZ1+EMZcSNCa+fh+j2uwx38b kCCxsKLReCiT9Ic/pQoMIMezw9l/n3d1ILVoYt7A= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99576] [coroutines] destructor of a temporary called too early within co_await expression Date: Sun, 04 Dec 2022 10:41:03 +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.2.1 X-Bugzilla-Keywords: C++-coroutines, wrong-code 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: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99576 --- Comment #16 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:58a7b1e354530d8dfe7d8fb859c8b8b5a9140f1f commit r13-4479-g58a7b1e354530d8dfe7d8fb859c8b8b5a9140f1f Author: Iain Sandoe Date: Wed Nov 30 17:05:56 2022 +0000 coroutines: Do not promote temporaries that will be elided. We usually need to 'promote' (i.e. save to the coroutine frame) any temporary variable that is in a target expression that must persist across an awa= it expression. However, if the TE is just used as a direct initializer for another object it will be elided - and we should not promote it since t= hat would lead to a DTOR call for something that is never constructed. Since we now have a mechanism to tell if TEs will be elided, use that. Although the PRs referenced initially appear to be different issues, th= ey all stem from this. Co-Authored-By: Adrian Perl Signed-off-by: Iain Sandoe PR c++/100611 PR c++/101367 PR c++/101976 PR c++/99576 gcc/cp/ChangeLog: * coroutines.cc (find_interesting_subtree): Do not promote temporaries that are only used as direct initializers for some other object. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr100611.C: New test. * g++.dg/coroutines/pr101367.C: New test. * g++.dg/coroutines/pr101976.C: New test. * g++.dg/coroutines/pr99576_1.C: New test. * g++.dg/coroutines/pr99576_2.C: New test.=