digitalmars.D.bugs - [Issue 4654] New: Cannot overload range iteration against opApply iteration
- d-bugmail puremagic.com (44/44) Aug 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4654
http://d.puremagic.com/issues/show_bug.cgi?id=4654 Summary: Cannot overload range iteration against opApply iteration Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com The following code doesn't compile even though there is no ambiguity: struct Range { uint num; property uint front() { return num; } void popFront() { num++; } bool empty() { return num >= 10; } int opApply(int delegate(ref int, ref int, ref int) dg) { int res; foreach(i; 0..10) { res = dg(i, i, i); if(res) break; } return res; } } void main() { Range range; foreach(elem; range) {} // Doesn't work. foreach(e1, e2, e3; range) {} // Works if previous line commented out. } test.d(28): Error: cannot infer type for elem -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2010