www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Possible Bug?

reply "Shripad K" <assortmentofsorts gmail.com> writes:
I have this code, which worked fine in  dmd 2.058:

private GC gc;

private alias gc.malloc  bson_malloc_func;
private alias gc.realloc  bson_realloc_func;
private alias gc.free      bson_free_func;

With dmd 2.060 I get this error when I compile:
Db/Bson.d(96): Error: variable Db.Bson.gc initializer required 
for type GC

Am I doing something wrong?

Shripad K
Sep 12 2012
parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 12-09-2012 22:59, Shripad K wrote:
 I have this code, which worked fine in  dmd 2.058:

 private GC gc;

 private alias gc.malloc  bson_malloc_func;
 private alias gc.realloc  bson_realloc_func;
 private alias gc.free      bson_free_func;

 With dmd 2.060 I get this error when I compile:
 Db/Bson.d(96): Error: variable Db.Bson.gc initializer required for type GC

 Am I doing something wrong?

 Shripad K

This is happening because the GC type in core.memory now has disable this(); in it, which disables its default constructor. You're not supposed to instantiate it; it is effectively a static struct. -- Alex Rønne Petersen alex lycus.org http://lycus.org
Sep 12 2012