bearophile Wrote:

> In this bug report I have asked for better error messages:
> http://d.puremagic.com/issues/show_bug.cgi?id=6696
> 
> But beside the error message, do you know why an immutable ref can't be given 
> to a function with a const ref argument? foo() can't change the contents of 
> the array a any way, so what's wrong in this code?
> 
> 
> void foo(const ref int[5] a) {}
> void main() {
>     immutable int[5] arr;
>     foo(arr); // Error?
> }

Looks like a bug. Seems like the compiler treats casted argument as an rvalue 
and you can't pass rvalue byref, can you?

Reply via email to