digitalmars.D.bugs - Possible bug in boxing unit?
H:\workspace\server>dmd -unittest -v main.d settings.d parse main parse settings semantic main semantic settings semantic2 main semantic2 settings semantic3 main semantic3 settings code main generating code for function 'main' code settings generating code for function 'this' generating code for function 'this' generating code for function '_dtor' generating code for function 'set' generating code for function 'unset' generating code for function 'get' generating code for function 'isSet' generating code for function 'keyList' generating code for function '__unittest0' generating code for function 'unboxable' generating code for function 'unboxCastInteger' E:\dmd\bin\..\..\dm\bin\link.exe main+settings,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved settings.obj(settings) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 H:\workspace\server> offending line: uint boxValue = unboxCastInteger!(uint)(b); everything works fine when it is removed. Complete source file as a reference: /////////////////////////////////////////////////////////////////////// module settings; private import std.boxer; class SettingsException : Exception { public this( char[] msg ) { super( msg ); } } class Settings { private Box [ char[] ]settingList; public this() { } public ~this() { } //sets or adds a setting key to the lsit public void set( char []name, Box value ) { Box *boxValue; //check if the name is already in the aa boxValue = (name in settingList); //if it's not, add it if ( boxValue == null ) { settingList[name] = value; } else { //we already have this name in the list, just change it settingList[name] = value; } } //used to remove a setting from the list public void unset( char []name ) { settingList.remove( name ); } //used to retrieve an item from the list based on its key public Box get( char []name ) { //if it's not in our list... if ( isSet( name ) == false ) { throw new SettingsException( "key not found in list" ); } return settingList[name]; } //do we have a setting with that key? public bool isSet( char []name ) { return (name in settingList) != null; } public char [][]keyList() { return settingList.keys; } unittest { Settings set = new Settings(); set.set( "abc", box( 1234 ) ); set.set( "abc", box( 1678 ) ); Box b = set.get( "abc" ); assert( unboxable!(uint)(b) ); uint boxValue = unboxCastInteger!(uint)(b); assert( boxValue == 1334 ); set.unset( "foo" ); assert( set.isSet( "bar" ) == false ); assert( set.isSet( "abc" ) == true ); set.unset( "abc" ); assert( set.isSet( "abc" ) == false ); } }
May 17 2006
In article <e4fisl$43r$1 digitaldaemon.com>, akcom says...H:\workspace\server>dmd -unittest -v main.d settings.d parse main parse settings semantic main semantic settings semantic2 main semantic2 settings semantic3 main semantic3 settings code main generating code for function 'main' code settings generating code for function 'this' generating code for function 'this' generating code for function '_dtor' generating code for function 'set' generating code for function 'unset' generating code for function 'get' generating code for function 'isSet' generating code for function 'keyList' generating code for function '__unittest0' generating code for function 'unboxable' generating code for function 'unboxCastInteger' E:\dmd\bin\..\..\dm\bin\link.exe main+settings,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved settings.obj(settings) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1Looks you've stumbled upon std.boxer's "Release Mode Bug". http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Phobos/StdBoxer It's already in BugZilla, too: http://d.puremagic.com/bugzilla/show_bug.cgi?id=8 jcc7
May 17 2006