www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Same Bug in dmd v0.94 as it was in v0.93

The 'D' code below was compiling and linking just fine in dmd v0.92, but now
with v0.93 and now v0.94 I'm getting a linker error:

<Linker error msg>

C:\dmd>bin\dmd ex1\main_roman.d ex1\roman.d
C:\dmd\bin\..\..\dm\bin\link.exe main_roman+roman,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

roman.obj(roman)  Offset 00148H Record Type 0091
Error 1: Previous Definition Different : _D5roman7isroman5ROMANAa
--- errorlevel 1

</Linker error msg>

Once I move the "const char[] ROMAN = "IVXLCDMivxlcdm";" line out of both of the
isroman() functions and to the top of the code, everything then compiles and
links nicely again within dmd v0.93 and now v0.94. Walter has already agreed
that this is a bug, so I placing it here. 

# // ** roman.d **
#
# import std.string;
#
# //const char[] ROMAN = "IVXLCDMivxlcdm";
#
# /************************************************
#  * Function      : bool isroman( in char )
#  * Created Date  : 03.Jun.04 
#  * Modified Date : (none)
#  * Requirements  : std.string
#  ************************************************
#  *
#  * Note: Needs std.string for the find() function.
#  */ 
# bool isroman
# (
#     in char cChar
# )
# {
#     const char[] ROMAN = "IVXLCDMivxlcdm";
#       
#     return ( find( ROMAN, cast(char)cChar ) != -1 ) ? true : false;
#
# } // end bool isroman( in char )
#
# /************************************************
#  * Function      : bool isroman( in char[] )
#  * Created Date  : 03.Jun.04 
#  * Modified Date : (none)
#  * Requirements  : std.string
#  ************************************************
#  *
#  * Note: Needs std.string for the find() function.
#  */ 
# bool isroman
# (
#     in char[] sStr
# )
# {
#     const char[] ROMAN = "IVXLCDMivxlcdm";
#      
#     foreach( int iStrPos, char cChar; sStr )
#     {
#         if ( find( ROMAN, cast(char)cChar ) == -1 ) return false;
#     } 
#      
#     return true;
#        
# } // end bool isroman( in char[] )


# // ** main_roman.d **
#
# import std.c.stdio;
#
# import roman;
#
# int main()
# {
#
#     printf( "isroman(\'M\')=%d\n", isroman( 'M' ) );
#     printf( "isroman(\"MMLV\")=%d\n", isroman( "MMLV" ) );
#    
#     return 0;
#    
# } // end int main()

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Jun 27 2004