www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14765] New: Rangified functions no longer accept types that

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

          Issue ID: 14765
           Summary: Rangified functions no longer accept types that
                    implicitly cast to string
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

///////////// test.d /////////////
import std.file;

struct Stringish
{
    string s;
    alias s this;
}

void main()
{
    auto fn = Stringish("test.d");
    readText(fn);
}
//////////////////////////////////

This now fails with this error output:

C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression
(front(this.r.s)) of type dchar to ubyte
C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression
(front(this.r.s)) of type dchar to ubyte
C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression
(front(this.r.s)) of type dchar to ubyte
C:\...\std\utf.d(3442,32): Error: template instance std.utf.byDchar!(Stringish)
error instantiating
C:\...\std\internal\cstring.d(188,40):        instantiated from here:
byWchar!(Stringish)
C:\...\std\file.d(245,54):        instantiated from here: tempCString!(wchar,
Stringish)
C:\...\std\file.d(412,35):        instantiated from here: read!(Stringish)
test.d(12,10):        instantiated from here: readText!(string, Stringish)
C:\...\std\internal\cstring.d(188,5): Error: forward reference to inferred
return type of function call __r3083.front()
C:\...\std\internal\cstring.d(86,6): Error: function
std.internal.cstring.tempCString!(wchar, Stringish).tempCString no return exp;
or assert(0); at end of function

--
Jul 02 2015