[Issue 15952] struct in closure is destroyed when parent function returns

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 6 17:07:18 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=15952

--- Comment #3 from Steven Schveighoffer <schveiguy at gmail.com> ---
As my issue got marked as a duplicate of this, I'd say the title and
expectation is different from mine.

It would be a noble goal for the compiler to try and make this work, but I
think the correct path is to disallow this delegate. Prior to 2.053, this was
an error because the destructor would render the instance invalid. I think we
should revert to that expectation -- a struct reference shnould not outlive its
lifetime.

--


More information about the Digitalmars-d-bugs mailing list