public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101367] New: [coroutines] destructor for capture in lambda temporary operand to co_yield expression called twice
@ 2021-07-07 16:16 noah at vectorized dot io
  2021-07-07 16:18 ` [Bug c++/101367] " noah at vectorized dot io
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: noah at vectorized dot io @ 2021-07-07 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101367
           Summary: [coroutines] destructor for capture in lambda
                    temporary operand to co_yield expression called twice
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noah at vectorized dot io
  Target Milestone: ---

I'm observing an issue in which it appears that the destructor for a captured
object in a lambda which is passed as a temporary to a co_await/co_yield
expression is being called twice.

Here is a reproducer https://godbolt.org/z/8jrGx7qsT which is a slight
modification of the reproducer used in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95599 that was related to the
order of destructors in co_await/co_yield expressions.

In the reproducer I gave when the lambda temporary doesn't capture a
std::string value things work, but when it does you can see that gcc reports
`free(): invalid pointer`.

It also appears that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611 may be
closely related.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-04 10:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:16 [Bug c++/101367] New: [coroutines] destructor for capture in lambda temporary operand to co_yield expression called twice noah at vectorized dot io
2021-07-07 16:18 ` [Bug c++/101367] " noah at vectorized dot io
2021-08-09  0:40 ` davidledger at live dot com.au
2021-08-09  1:09 ` noah at vectorized dot io
2021-08-10  3:06 ` davidledger at live dot com.au
2021-08-10  3:59 ` noah at vectorized dot io
2021-10-01 19:18 ` iains at gcc dot gnu.org
2022-12-04 10:41 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).