digitalmars.D.bugs - [Issue 1367] New: D 2.003 breaks foreach looping over delegate
- d-bugmail puremagic.com (51/51) Jul 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1367
- d-bugmail puremagic.com (8/8) Jul 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1367
- d-bugmail puremagic.com (9/9) Jun 24 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1367
http://d.puremagic.com/issues/show_bug.cgi?id=1367 Summary: D 2.003 breaks foreach looping over delegate Product: D Version: 2.002 Platform: PC URL: http://www.digitalmars.com/d/statement.html#ForeachState ment OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: thecybershadow gmail.com Slightly modified example from http://www.digitalmars.com/d/statement.html#ForeachStatement (to use a delegate reference instead of opApply: import std.stdio; class Foo { uint array[2]; int looper(int delegate(ref uint) dg) { int result = 0; for (int i = 0; i < array.length; i++) { result = dg(array[i]); if (result) break; } return result; } void run() { foreach (uint u; &looper) writefln("%d", u); } } void main() { Foo a = new Foo(); a.array[0] = 73; a.array[1] = 82; a.run(); } Compiler prints: foreach_delegate.d(22): Error: foreach: int function(int delegate(ref uint) dg)* is not an aggregate type This worked in DMD 2.002. opApply features seem unaffected. --
Jul 23 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1367 thecybershadow gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |regression Summary|D 2.003 breaks foreach |D 2.003 breaks foreach |looping over delegate |looping over delegate --
Jul 23 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1367 clugdbug yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME ------- Comment #1 from clugdbug yahoo.com.au 2008-06-24 02:04 ------- Works in 2.015 --
Jun 24 2008