New structs

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 10 11:09:58 PDT 2010


On Fri, 10 Sep 2010 13:55:37 -0400, Andrej Mitrovic  
<andrej.mitrovich at gmail.com> wrote:

> Is this D1 code? Because in D2:
>
> S2* c = new S1(); //  Error: cannot implicitly convert expression (new
> S1) of type S1* to S2*
>
> S2* d = cast(S2*) GC.malloc(S2.sizeof);
> d = S2();  // Error: cannot implicitly convert expression (S2(0)) of
> type S2 to S2*
>
> Neither of those work.

I think it was a typo.  He meant

S1* c = new S1()

BTW, I filed a bug report on this a while back:

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

-Steve


More information about the Digitalmars-d mailing list