June 11, 2021 [Issue 22017] New: with() on struct method that returns this destroys too early | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22017 Issue ID: 22017 Summary: with() on struct method that returns this destroys too early Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de Consider the following code: struct S { bool destroyed; ~this() { destroyed = true; } ref S foo() return { return this; } } void main() { with (S().foo) { assert(!destroyed); } } Even if the with() expression is copied, the copied version should not see the results of the destructor call. However, the assert fails. -- |
Copyright © 1999-2021 by the D Language Foundation