[Issue 15027] New: cannot pass arguments of type DirEntry to std.file functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 7 23:59:31 PDT 2015


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 at puremagic.com
          Reporter: r.sagitario at 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.

--


More information about the Digitalmars-d-bugs mailing list