[Issue 6128] New: Struct destructor isn't run when used in with statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 8 14:25:23 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6128

           Summary: Struct destructor isn't run when used in with
                    statement
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: simen.endsjo at pandavre.com


--- Comment #0 from simendsjo <simen.endsjo at pandavre.com> 2011-06-08 14:20:51 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list