[Issue 8269] The 'with statement' does not observe temporary object lifetime
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 11 03:21:49 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=8269
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |verylonglogin.reg at gmail.com
Severity|normal |major
--- Comment #5 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
Smaller testcase:
---
struct S
{
bool alive = true;
~this() { alive = false; }
}
void main()
{
with(S()) // <-- `S` is created and destructed here
assert(alive); // fails
}
---
This is a major issue as it breaks RAII.
--
More information about the Digitalmars-d-bugs
mailing list