www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15027] New: cannot pass arguments of type DirEntry to

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

          Issue ID: 15027
           Summary: cannot pass arguments of type DirEntry to std.file
                    functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

On git-head, this loop no longer compiles:

import std.file;

string foo()
{
    foreach(f; dirEntries("/", "*", SpanMode.shallow, false))
        if(std.file.isDir(f))
            return f;
    return null;
}

dmd -c test.d
test.d(8): Error: template std.file.isDir cannot deduce function from argument types !()(DirEntry), candidates are: c:\s\d\rainers\phobos\std\file.d(1399): std.file.isDir(R)(R name) if (isInputRange!R && isSomeChar!(ElementEncodingType!R)) compiling with dmd-2.068.1 is ok. The problem seems to be that the rangified file functions no longer accept arguments that alias this to strings. --
Sep 07 2015