http://d.puremagic.com/issues/show_bug.cgi?id=11261
Summary: Can't infer types without explicit slice in foreach Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: jesse.k.phillip...@gmail.com --- Comment #0 from Jesse Phillips <jesse.k.phillip...@gmail.com> 2013-10-14 10:54:11 PDT --- When using a range to proved a key-value tuple, the compiler is unable to infer the key-value in a foreach when slice is not present (2). Using an array continues to work (1). This functioned in 2.63. import std.typecons; import std.range; class Container { alias Tuple!(string, "key", string, "value") Key; InputRange!Key opSlice() { // 1 Key[] opSlice() { Range r; return inputRangeObject(r); // 1 return [Key("myKey", "My Value")]; } private struct Range { enum empty = false; auto popFront() { } auto front() { return Key("myKey", "myValue"); } } } void main() { auto container = new Container(); foreach(k,v; container) // 2 foreach(k,v; container[]) { break; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------