Standard struct constructors for the heap?

Steven Schveighoffer schveiguy at yahoo.com
Thu May 17 06:23:55 PDT 2012


On Wed, 16 May 2012 19:50:25 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Regarding the efforts of removing limitations from D, do you know if  
> there are problems in implementing this oldish enhancement request?
>
> http://d.puremagic.com/issues/show_bug.cgi?id=4086

Should be absolutely feasible.

I'd also like to see this work:

struct X
{
    int x;
    this(int x) {this.x = x;}
}

void main(){
   X x; // no ctor needed
   X *xp = new X; // but this is an error!
}

-Steve


More information about the Digitalmars-d mailing list