On Sun, 11 Dec 2011 19:40:42 +0100 Mafi <m...@example.org> wrote: > void f(ref const(int)* a, const(int)* b) {a = b; } > void main() { > immutable(int)* a; > auto b = (new int[](5)).ptr; > f(a, b); > //if this compiles I have just assigned a mutable pointer > //to an immutable one > } > > With the above definition using inout, such a call would be > disallowed.
Just gave this code a try: void f(ref const(int)* a, const(int)* b) {a = b; } void main() { const(int)* a; immutable(int)* b; auto c = (new int[](5)).ptr; f(a, c); f(b, c); //test.d(7): Error: cast(const(int)*)b is not an lvalue }