Internal error from DMD

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri Jun 23 18:37:31 PDT 2006


"Bradley Smith" <digitalmars-com at baysmith.com> wrote in message 
news:e7hvil$1ffi$1 at digitaldaemon.com...
> Is this a bug? Should the DMD compiler ever give an internal error?

Considering it's in alpha, the compiler is allowed to have some slack ;) 
But no, it's not _supposed_ to have internal errors.  Any internal error is 
a bug.

> import std.stdio;
> import std.boxer;
>
> void main() {
> Object[] l;
> l ~= cast(Object) box(1);

You can't cast a box to Object; box is a struct, not a class.  If you want 
an array of boxes, hava a look at boxArray().

> int a = unbox!(int)(cast(Box) l[0]);
> writefln("value %d", a);
> }
>
> >dmd tmp.d c:\dmd\src\phobos\std\boxer.d
> tmp.d(6): e2ir: cannot cast from Box to object.Object
> tmp.d(7): e2ir: cannot cast from object.Object to Box
> Internal error: e2ir.c 267 





More information about the Digitalmars-d-learn mailing list