[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 --- Comment #8 from github-bugzi...@puremagic.com 2013-03-05 22:52:16 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4573ac12bbe1fde782684ed9042f57ab53b05e90 fix Issue 2486 - taking address of slice rvalue is valid -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 yebblies changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #7 from yebblies 2013-01-07 13:45:08 EST --- *** Issue 9270 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 --- Comment #6 from github-bugzi...@puremagic.com 2012-12-06 21:50:15 PST --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/7062ce191a651ca94fc779ac646a5ef5653b4559 fix Issue 2486 - taking address of slice rvalue is valid https://github.com/D-Programming-Language/phobos/commit/af4fea78550216647dbf3e4aaa7d89ab1b79f542 Merge pull request #989 from 9rnsr/fix2486 Issue 2486 - taking address of slice rvalue is valid -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 Kenji Hara changed: What|Removed |Added Keywords||accepts-invalid, pull --- Comment #5 from Kenji Hara 2012-12-02 22:22:32 PST --- D2 pull: https://github.com/D-Programming-Language/dmd/pull/1343 https://github.com/D-Programming-Language/phobos/pull/989 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 --- Comment #4 from Kenji Hara 2012-02-23 02:38:57 PST --- I found related bug that returning slice by auto ref causes an error. struct S { int[] a; auto ref opSlice(){ return a[]; } // line 4 } void main() { S s; s[]; } Output: test.d(4): Error: slice expression this.a[] is not a modifiable lvalue -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 --- Comment #3 from Kenji Hara 2012-01-24 05:38:49 PST --- Maybe the documentation fix is: https://github.com/D-Programming-Language/d-programming-language.org/commit/8681d6fb36bd7a00a395bfc66205d5dbe8b19d88 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 Walter Bright changed: What|Removed |Added Keywords|spec| CC||bugzi...@digitalmars.com --- Comment #2 from Walter Bright 2012-01-22 20:13:33 PST --- I agree, and will fix the spec. So it's a compiler bug that this code is accepted. It should only work for const references. Changing to a compiler bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2486] taking address of slice rvalue is valid
http://d.puremagic.com/issues/show_bug.cgi?id=2486 Kenji Hara changed: What|Removed |Added Platform|x86 |All Version|1.037 |D1 & D2 OS/Version|Linux |All Severity|minor |normal --- Comment #1 from Kenji Hara 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: ---