dmd 1.057 and 2.041 release

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 12 06:20:24 PST 2010


On Fri, 12 Mar 2010 09:14:26 -0500, Ivan <ivan.senji at gmail.com> wrote:

> On 8.3.2010 7:54, Walter Bright wrote:
>> Lots of meat and potatoes here, and a cookie! (spelling checker for
>> error messages)
>>
>> http://www.digitalmars.com/d/1.0/changelog.html
>> http://ftp.digitalmars.com/dmd.1.057.zip
>>
>>
>> http://www.digitalmars.com/d/2.0/changelog.html
>> http://ftp.digitalmars.com/dmd.2.041.zip
>>
>> Thanks to the many people who contributed to this update!
>
> In 2.040 this worked:
>
> real x = 1.2;
>
> real[4][4] M2 = [
> 	[1, 0, 0, x],
> 	[0, 1, 0, x],
> 	[0, 0, 1, x],
> 	[0, 0, 0, 1]
> ];
>
>
> In 2.041 it has to be written like this:
>
> real x = 1.2;
>
> real[4][4] M2 = [
> 	[1, 0, 0, x],
> 	[0, 1, 0, x],
> 	[0, 0, 1, x],
> 	[0, 0, 0, cast(real)1]
> ];
>
> Don't know if the first one should still work and this is a bug or is  
> the new behaviour ok so I am checking here.
>
> The error on the first array initialization in 2.041 is
>
> Error: incompatible types for (([cast(real)1,cast(real)0,cast(real)0,x])  
> ? ([0,0,0,1])): 'real[]' and 'int[]'
> ArraysTest.d(23): Error: cannot implicitly convert expression  
> ([0L,1L,0L,x]) of type real[] to int
> ArraysTest.d(23): Error: cannot implicitly convert expression  
> ([0L,0L,1L,x]) of type real[] to int

This is a bug.  Any time you are specifying the exact type on the lhs of a  
literal assignment, the literal should be typed that way.

-Steve


More information about the Digitalmars-d-announce mailing list