From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3DC15385221C; Sun, 4 Dec 2022 10:41:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DC15385221C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670150464; bh=rypnYoI1oKh8iBYEzJSlyf0nvmy2p489NBZ1eudLxSQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VR2KY7xxFpB+BedZ9/An7oZFlJYbMMFAk2JR91oiQJZ5+JIfp+43UsOJTylnCJ0Fb 3rW0U17xNBe3njS7MfN45x4vZLvIkeXdWp6xBmHNhU1/8wvzdw8nc2AcntT+CGudvM HU3AeFG/llPs8kb6wpAdHu7A1ZVse8Febkh7+ZaM= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101976] When constructing object, calling function and performing co_await in same statement, temporary is erroneously moved trivially 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: 11.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: 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=3D101976 --- Comment #2 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.=