[Issue 22017] with() on struct method that returns this destroys too early

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 11 11:20:22 UTC 2021


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

--- Comment #1 from FeepingCreature <default_357-line at yahoo.de> ---
As far as I can tell, what happens is that with() thinks that it doesn't need
to generate a temporary variable because its expression is an lvalue, due to
the ref return. Since the expression *does* result in a temporary cleanup with
destructor, however, the destructor is inserted immediately after the with()
expression, instead of after the body.

--


More information about the Digitalmars-d-bugs mailing list