https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611

            Bug ID: 100611
           Summary: coroutines: destructor called too many times for
                    coroutine lambda stored object
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nilsgladitz at gmail dot com
  Target Milestone: ---

Created attachment 50816
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50816&action=edit
test case

Given the attached test case compiled and run with e.g.
 g++ test.cpp -std=c++20 -fcoroutines && ./a.out

produces the output:
 Foo(23) 0x55c938eb5ed4
 Foo(const& 23) 0x55c938eb5ee4
 ~Foo(23) 0x55c938eb5ee0
 ~Foo(23) 0x55c938eb5ee4
 ~Foo(23) 0x55c938eb5ed4

Indicating that "Foo" is constructed more often than it gets destructed.

This may be a variation of or related to bug 99576 which my test case is based
on.

Bug 99576 seems to be observable in 10.2 while this new issue seems to be
observable in 10.3 and 11.1.

Bisecting the gcc-10 release branch the dividing commit seems to be:
 commit f43a1b1d1718969423337190ddbbbc9037c67783
 Author: Iain Sandoe <i...@sandoe.co.uk>
 Date:   Sun Jul 19 18:39:21 2020 +0100

     coroutines: Correct frame capture of compiler temps [PR95591+4].

Reply via email to