"Steven Schveighoffer" <[email protected]> wrote in message news:[email protected]... > On Tue, 20 Sep 2011 07:33:20 -0400, bearophile <[email protected]> > wrote: > >> void foo(const ref int[5] a) {} >> void main() { >> immutable int[5] arr; >> foo(arr); // Error? >> } > > The complaint from the compiler is that cast(const(int[5u])) arr is not an > lvalue.
It's a bug, the compiler shouldn't be inserting a cast when the value implicitly converts. It's also a bug when the compiler tries to optimise away the variable to a literal when passing by reference, I've got a patch for this I haven't written up yet.
