www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22002] New: std.algorithm.each breaks when used with

https://issues.dlang.org/show_bug.cgi?id=22002

          Issue ID: 22002
           Summary: std.algorithm.each breaks when used with
                    InputRangeObject
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mipri minimaltype.com

The following complete example

unittest {
    import std.algorithm : each;
    import std.range : only, inputRangeObject;
    import std.stdio : writeln;

    only(1, 2).inputRangeObject.each!writeln;
}

Fails with this error:

each.d(6): Error: `std.algorithm.iteration.each!(writeln).each` called with
argument types `(InputRangeObject!(OnlyResult!(int, int)))` matches both:
phobos/std/algorithm/iteration.d(953):    
`std.algorithm.iteration.each!(writeln).each!(InputRangeObject!(OnlyResult!(int,
int))).each(InputRangeObject!(OnlyResult!(int, int)) r)`
and:
phobos/std/algorithm/iteration.d(1014):    
`std.algorithm.iteration.each!(writeln).each!(InputRangeObject!(OnlyResult!(int,
int))).each(InputRangeObject!(OnlyResult!(int, int)) r)`

With DMD64 D Compiler v2.097.0

--
Jun 07