http://d.puremagic.com/issues/show_bug.cgi?id=2486
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Platform|x86 |All Version|1.037 |D1 & D2 OS/Version|Linux |All Severity|minor |normal --- Comment #1 from Kenji Hara <[email protected]> 2011-11-10 03:09:27 PST --- This is still valid in D2. import std.stdio; void main() { int[] arr = [1,2,3]; auto p = &(arr[0..2]); // same as &(arr[0..2]) writeln(typeof(p).stringof); // int[]* writeln(arr.ptr); writeln(&arr); writeln(p); assert(&arr == p); } I think this is bad behavior, because it allows nonsense code like follows. void main() { int[] arr = [1,2,3]; foo(arr[0..2]); // ref parameter can receive lvalue made by slicing assert(arr == [1,2,3]); // assertion succeeds... } void foo(ref int[] arr) { arr = [4,5,6]; // what is modified? } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
