[Issue 892] New: Another bug in the new GC - pointers in mixins
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Jan 26 12:20:41 PST 2007
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=892
           Summary: Another bug in the new GC - pointers in mixins
           Product: D
           Version: 1.001
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com
This is actually with DMD version 1.003 (and I suspect 1.001, and 1.002).
This program destroys the object from the mixin even though it is still very
much referenced by live objects in the program.
------
import std.stdio;
static import std.gc;
class SomeObject
{
    this() { writefln("SomeObject created"); }
    ~this() { writefln("SomeObject destroyed"); }
}
template Mix()
{
    void init() {
        ptr = new SomeObject;
    }
    SomeObject ptr;
}
class Container
{
    this() { init(); }
    mixin Mix;
}
void main()
{
    auto x = new Container;
    writefln("---Pre collect");
    std.gc.fullCollect();
    writefln("---Post collect");
}
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list