Thread overview
[Issue 22017] with() on struct method that returns this destroys too early
Jun 11, 2021
Mario Kroeplin
Jun 11, 2021
FeepingCreature
Jun 15, 2021
Dlang Bot
Dec 17, 2022
Iain Buclaw
June 11, 2021
https://issues.dlang.org/show_bug.cgi?id=22017

Mario Kroeplin <kroeplin.d@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
                 CC|                            |kroeplin.d@googlemail.com

--
June 11, 2021
https://issues.dlang.org/show_bug.cgi?id=22017

--- Comment #1 from FeepingCreature <default_357-line@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.

--
June 15, 2021
https://issues.dlang.org/show_bug.cgi?id=22017

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/dmd pull request #12688 "Fix Issue 22017 - with() on struct method that returns this destroys too early" fixing this issue:

- Fix Issue 22017 - with() on struct method that returns this destroys too
early

https://github.com/dlang/dmd/pull/12688

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22017

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

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

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18039

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--