www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15236] New: std.range.chain cannot chain a std.range.repeat

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

          Issue ID: 15236
           Summary: std.range.chain cannot chain a std.range.repeat string
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

This seems to be a problem in the way the template constraint for chain finds
the element types for all of the ranges. It thinks that the element type for
Take!(Repeat!string) is string, so it comes up with CommonType!(string, dchar)
which is void.


-----------------------
import std.range;

void main()
{
    string a = "abc";
    string b = "xyz";
    chain(repeat(a, 2), b);
}

test.d(8): Error: template std.range.chain cannot deduce function from argument
types !()(Take!(Repeat!string), string)

--
Oct 22 2015