Thread overview
[Issue 6128] New: Struct destructor isn't run when used in with statement
Jun 08, 2011
simendsjo
Jul 21, 2011
Andrej Mitrovic
Apr 24, 2012
SomeDude
Feb 08, 2013
Andrej Mitrovic
June 08, 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@puremagic.com
        ReportedBy: simen.endsjo@pandavre.com


--- Comment #0 from simendsjo <simen.endsjo@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: -------
July 21, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6128


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-07-21 12:49:45 PDT ---
This seems to be fixed in 2.054:

scoped:
 this
 ~this
with:
 this
 ~this

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6128


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com


--- Comment #2 from SomeDude <lovelydear@mailmetrash.com> 2012-04-24 01:27:30 PDT ---
Runs fine on 2.059 too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6128


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-08 14:05:10 PST ---
Works in 2.061.

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