digitalmars.D.bugs - [Issue 8974] New: closure delegate might break preceding code
- d-bugmail puremagic.com (49/49) Nov 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8974
- d-bugmail puremagic.com (11/11) Nov 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8974
http://d.puremagic.com/issues/show_bug.cgi?id=8974 Summary: closure delegate might break preceding code Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: fawzi gmx.ch --- Comment #0 from Fawzi Mohamed <fawzi gmx.ch> 2012-11-07 14:52:41 PST --- I found the particularly nasty example where introducing a non scoped delegate breaks the preceding loop with DMD 2.060. ------------- module t6; import core.stdc.stdio; void ff(T)(T[] arr1){ T[] copyArr=new T[](arr1.length); size_t ii=0; foreach(size_t i,T e;arr1){ // i is invalid, accessing did segfaults in the original bug // changing the delegate below (to remove code dep) it is now "only" invalid printf("i=%ld\n",i); scope dl=delegate void(int sink){ if (i>10) assert(0); }; } ii=0; // using a scoped delegate here removes the bug auto dlg=delegate bool(ref T*el){ if (ii<1){ // originally also ++ii; return true; } return false; }; } int main(string[]args){ int[]narr=new int[](3); ff(narr); return 0; } ---------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8974 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-11-08 21:15:15 PST --- *** This issue has been marked as a duplicate of issue 8526 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2012