Bug 6128 – Struct destructor isn't run when used in with statement
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-06-08T14:20:00Z
Last change time
2013-02-08T14:05:10Z
Assigned to
nobody
Creator
simendsjo
Comments
Comment #0 by simendsjo — 2011-06-08T14:20:51Z
This is using dmd 2.053 on win7 32bit
import std.stdio;
void main() {
struct S {
this(bool a) { writeln(" this"); }
~this() { writeln(" ~this"); }
}
writeln("scoped:");
{
auto s = S(true);
}
writeln("with:");
with(S(true)) {
}
}
Output:
scoped:
this
~this
with:
this
Comment #1 by andrej.mitrovich — 2011-07-21T12:49:45Z
This seems to be fixed in 2.054:
scoped:
this
~this
with:
this
~this
Comment #2 by lovelydear — 2012-04-24T01:27:30Z
Runs fine on 2.059 too.
Comment #3 by andrej.mitrovich — 2013-02-08T14:05:10Z