From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB0753852C42; Sun, 4 Dec 2022 10:41:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB0753852C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670150462; bh=bw2guE6TMQD5y4FqX4CXCPj/S0KrllGFnVKGDCATNpc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=a9iSvjS2Bo0PkfbN/hOOllFbgocJwdgYX/ivUGvVODdq7rfO8V1OzozDcblRirsIX kAKhWEI+VcICU9BleMaJB5u1i+5ZCoyWUrGFZMcIHZGYaHnSI1pSM0q5I64DJQQf1e uBZTkcAjLch1WPdYNczWafJBzfBWtheQwNeNWBks= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101367] [coroutines] destructor for capture in lambda temporary operand to co_yield expression called twice Date: Sun, 04 Dec 2022 10:41:00 +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: 12.0 X-Bugzilla-Keywords: C++-coroutines, c++-lambda, 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: --- 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=3D101367 --- Comment #6 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.=