Another bug in the GC

Bill Baxter dnewsgroup at billbaxter.com
Sat Jan 27 04:25:10 PST 2007


This bug seems to be related to pointers in mixins not getting treated 
as pointers.
(filed as bug 892 -- just posting here to make sure it gets noticed)

------------------------
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");
}
------------------------------------

With DMD 1.003 this outputs:

SomeObject created
---Pre collect
SomeObject destroyed
---Post collect



More information about the Digitalmars-d mailing list