Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
November 12, 2011 [Issue 6934] New: [CTFE] std.range.transversal at compile-time too | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6934 Summary: [CTFE] std.range.transversal at compile-time too Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2011-11-11 19:41:18 PST --- It seems transversal() can't run at compile-time: import std.range: transversal; int foo() { auto M = [[1,2], [3,4]]; foreach (x; transversal(M, 0)) {} return 0; } enum _ = foo(); void main() {} DMD 2.057head gives: ...\dmd2\src\phobos\std\array.d(328): Error: Cannot determine length of Transversal([[1,2],[3,4]],0u)._input at compile time ...\dmd2\src\phobos\std\range.d(4648): called from here: popFront(this._input) test.d(4): called from here: __r1.popFront() test.d(7): called from here: foo() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 19, 2011 [Issue 6934] [CTFE] std.range.transversal at compile-time too | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6934 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-11-19 00:03:47 PST --- Reduced test case: ------ struct Struct6934 { int[] x = [1,2]; } void bar6934(ref int[] p) { p = p[1..$]; } int bug6934() { Struct6934 q; bar6934(q.x); return 1; } static assert(bug6934()); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 19, 2011 [Issue 6934] [CTFE] can't use $ in a slice of an array passed by ref | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6934 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-11-19 12:24:51 PST --- In fact passing arrays by reference is broken in non-trivial cases. Changing the test case to include an index or slice assignment reveals wrong-code problems: void bar6934(ref int[] p) { p[0] = 12; assert(p[0] == 12); // fails!!! p[0..1] = 17; assert(p[0] == 17); // fails!!! p = p[1..$]; } This applies to any complicated passing of an array by ref (any dotvar or index expression, or combination thereof). It applies to array index assignment, and slice assignment. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 15, 2011 [Issue 6934] [CTFE] can't use $ in a slice of an array passed by ref | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6934 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2011-12-14 16:56:46 PST --- https://github.com/D-Programming-Language/dmd/commit/746d98fb0daacbd6a9efab1da6aacd2d7b55b39f https://github.com/D-Programming-Language/dmd/commit/0051ed8ea86472083ed205a4857399d1f8defd71 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 15, 2011 [Issue 6934] [CTFE] can't use $ in a slice of an array passed by ref | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6934 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |youxkei@gmail.com --- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-12-14 23:04:34 PST --- *** Issue 7109 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: ------- |
Copyright © 1999-2021 by the D Language Foundation