www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.boxer problem

reply Tydr Schnubbis <fake address.dude> writes:
Why can't I cast from Object to Box?  That seems to defeat the purpose 
of boxing.  I get this error:

serverlist.d(185): e2ir: cannot cast from object.Object to Box
Internal error: e2ir.c 267
Apr 29 2006
next sibling parent reply Alexander Panek <alexander.panek brainsware.org> writes:
Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose 
 of boxing.  I get this error:
 
 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
Object o = new Object(); Box b = box(o); foo bar = unbox!(foo)(b); Regards, Alexander Panek
Apr 29 2006
parent reply Tydr Schnubbis <fake address.dude> writes:
Alexander Panek wrote:
 Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose 
 of boxing.  I get this error:
 
 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
Object o = new Object(); Box b = box(o); foo bar = unbox!(foo)(b);
No luck. import std.boxer; void main() { Object o = new Object(); Box b = box(o); int bar = unbox!(int)(b); } c:\prog\test\D>dmd boxing2.d c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxing2.obj(boxing2) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 -------- Maybe it's just a configuration problem? I've got dmd 0.155.
Apr 29 2006
parent reply John Demme <me teqdruid.com> writes:
Tydr Schnubbis wrote:

 Alexander Panek wrote:
 Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose
 of boxing.  I get this error:
 
 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
Object o = new Object(); Box b = box(o); foo bar = unbox!(foo)(b);
No luck. import std.boxer; void main() { Object o = new Object(); Box b = box(o); int bar = unbox!(int)(b); } c:\prog\test\D>dmd boxing2.d c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxing2.obj(boxing2) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 -------- Maybe it's just a configuration problem? I've got dmd 0.155.
That one's a bug with templating code inside of libraries. You need to compile your code with -release. ~John Demme
Apr 29 2006
parent reply Tydr Schnubbis <fake address.dude> writes:
John Demme wrote:
 Tydr Schnubbis wrote:
 
 Alexander Panek wrote:
 Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose
 of boxing.  I get this error:
 
 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
Object o = new Object(); Box b = box(o); foo bar = unbox!(foo)(b);
No luck. import std.boxer; void main() { Object o = new Object(); Box b = box(o); int bar = unbox!(int)(b); } c:\prog\test\D>dmd boxing2.d c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxing2.obj(boxing2) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 -------- Maybe it's just a configuration problem? I've got dmd 0.155.
That one's a bug with templating code inside of libraries. You need to compile your code with -release.
Ah, so I guess it's currently unusable for real projects, then. I solved my original problem without using boxing. So I'm okay for now. :)
Apr 29 2006
parent Daniel Keep <daniel.keep.lists gmail.com> writes:
Tydr Schnubbis wrote:
 John Demme wrote:
 Tydr Schnubbis wrote:

 Alexander Panek wrote:
 Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose
 of boxing.  I get this error:

 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
Object o = new Object(); Box b = box(o); foo bar = unbox!(foo)(b);
No luck. import std.boxer; void main() { Object o = new Object(); Box b = box(o); int bar = unbox!(int)(b); } c:\prog\test\D>dmd boxing2.d c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxing2.obj(boxing2) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 -------- Maybe it's just a configuration problem? I've got dmd 0.155.
That one's a bug with templating code inside of libraries. You need to compile your code with -release.
Ah, so I guess it's currently unusable for real projects, then. I solved my original problem without using boxing. So I'm okay for now. :)
If I remember correctly, it's because we don't have a debug build of Phobos. You can build one yourself (ie: rebuild phobos with debug stuff in). Or, you can do what I did and "provide" the function that it's missing: // Burton Radons <burton-radons[at]smocky[dot]com> // This entry allows -unittest for testing, and/or no need // for the -release switch private extern (C) void assert_3std5boxer() {} I personally just stuck that in a file called "dmdbug_std_boxer_assert.d", so that I can just remove the import when it gets fixed :) -- Daniel -- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Apr 29 2006
prev sibling parent Sean Kelly <sean f4.ca> writes:
Tydr Schnubbis wrote:
 Why can't I cast from Object to Box?  That seems to defeat the purpose 
 of boxing.  I get this error:
 
 serverlist.d(185): e2ir: cannot cast from object.Object to Box
 Internal error: e2ir.c 267
A compiler crash is never a good thing. Please file a bug report for this :-) Sean
Apr 29 2006