[dmd-beta] dmd 2.053 beta

David Simcha dsimcha at gmail.com
Sat May 7 19:41:50 PDT 2011


On 5/7/2011 10:07 PM, Stephan Dilly wrote:
> This code  used to work under dmd2.052:
>
> const int[] foo = [1,2,3,4];
>
> void main(string[] argv)
> {
>     int[] bar = foo;
> }
>
> now the compiler says: main.d(30): Error: cannot implicitly convert 
> expression (foo) of type const(int[]) to int[]
>
> but i checked the old behaviour and the compiler made a foo.dup 
> implicitly. was this an intended fix or is it a regression now ? This 
> makes dwt2 not able to compile with the current beta.

I think the new behavior is correct.  Putting an automatic .dup in there 
is a bad idea.  This can easily be done explicitly, with minimal added 
verboseness.


More information about the dmd-beta mailing list