www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17321] New: Example code for std.stdio.File fails to compile

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

          Issue ID: 17321
           Summary: Example code for std.stdio.File fails to compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

http://dlang.org/phobos/std_stdio.html#.File.readf

The example code is:

void main()
{
    import std.stdio;
    auto f = File("input");
    foreach (_; 0 .. 3)
    {
        int a;
        f.readf!" %d"(a);
        writeln(++a);
    }
}

and does not compile:

test.d(8): Error: template instance std.stdio.File.readf!" %d" does not match
template declaration readf(Data...)(in char[] format, Data data) if
(allSatisfy!(isPointer, Data))

--
Apr 13