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

           Summary: Static struct's destructor called on exit of function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-07-22 
22:08:18 PDT ---
import std.stdio;

void main()
{
   test();
   test();
}

struct Foo
{
   int state = 1;

   ~this()
   {
       state = 0;
   }
}

void test()
{
   static Foo foo;
   writeln(foo.state);
}


Prints:
1
0

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

Reply via email to