digitalmars.D.learn - Internal error from DMD
- Bradley Smith (14/15) Jun 23 2006 Is this a bug? Should the DMD compiler ever give an internal error?
- Jarrett Billingsley (7/20) Jun 23 2006 Considering it's in alpha, the compiler is allowed to have some slack ;)...
- Bradley Smith (9/37) Jun 24 2006 I didn't mean to be overly critical of the compiler. I wasn't sure how
- Jarrett Billingsley (11/17) Jun 24 2006 Oh no, I didn't take it that way. Don't worry about it.
- Bradley Smith (8/12) Jun 25 2006 I'm experimenting with converting some Java code to D, and the code
- Chris Nicholson-Sauls (30/47) Jun 26 2006 Well, if it only ever works with those three types, you could go with a ...
Is this a bug? Should the DMD compiler ever give an internal error? import std.stdio; import std.boxer; void main() { Object[] l; l ~= cast(Object) box(1); int a = unbox!(int)(cast(Box) l[0]); writefln("value %d", a); }dmd tmp.d c:\dmd\src\phobos\std\boxer.dtmp.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 Thanks, Bradley
Jun 23 2006
"Bradley Smith" <digitalmars-com baysmith.com> wrote in message news:e7hvil$1ffi$1 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.dtmp.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
Jun 23 2006
I didn't mean to be overly critical of the compiler. I wasn't sure how to interpret the "Internal error" message, and I just wanted to confirm that the objective was to not have any internal errors. What is the proper procedure for reporting a bug? Thanks for the pointer about Box and Object. I'm still learning how D handles data. Thanks, Bradley Jarrett Billingsley wrote:"Bradley Smith" <digitalmars-com baysmith.com> wrote in message news:e7hvil$1ffi$1 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.dtmp.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
Jun 24 2006
"Bradley Smith" <digitalmars-com baysmith.com> wrote in message news:449CF0E7.3020107 baysmith.com...I didn't mean to be overly critical of the compiler. I wasn't sure how to interpret the "Internal error" message, and I just wanted to confirm that the objective was to not have any internal errors.Oh no, I didn't take it that way. Don't worry about it.What is the proper procedure for reporting a bug?The most proper is through the D bugzilla: http://d.puremagic.com/bugzilla/index.cgi You'll set up an account and then you can add the bug using the "Enter a new issue" link. As far as I can find, this issue hasn't been added to bugzilla yet.Thanks for the pointer about Box and Object. I'm still learning how D handles data.Sure. Just wondering what you're trying to store? There might be a simpler way to store it, whatever it is; I've personally never had to use boxes, though maybe you're coming from a dynamically typed background.
Jun 24 2006
Jarrett Billingsley wrote:Sure. Just wondering what you're trying to store? There might be a simpler way to store it, whatever it is; I've personally never had to use boxes, though maybe you're coming from a dynamically typed background.I'm experimenting with converting some Java code to D, and the code stores int, boolean, and String data in a list through the Integer and Boolean wrapper objects. Using the D boxer is the only way I've found to create a heterogeneous array which includes primitive data elements. Perhaps the need for boxing could be eliminated by making the code more D-like, but at this point, I'm only trying a straight translation. Bradley
Jun 25 2006
Bradley Smith wrote:Jarrett Billingsley wrote:Well, if it only ever works with those three types, you could go with a Var struct. You can simplify creation of Var structs with a set of static call operators, like such: While it isn't /the/ most elegant solution possible, its tried and true, and pretty effective for definite sets of types. -- Chris Nicholson-SaulsSure. Just wondering what you're trying to store? There might be a simpler way to store it, whatever it is; I've personally never had to use boxes, though maybe you're coming from a dynamically typed background.I'm experimenting with converting some Java code to D, and the code stores int, boolean, and String data in a list through the Integer and Boolean wrapper objects. Using the D boxer is the only way I've found to create a heterogeneous array which includes primitive data elements. Perhaps the need for boxing could be eliminated by making the code more D-like, but at this point, I'm only trying a straight translation. Bradley
Jun 26 2006