D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17321 - Example code for std.stdio.File fails to compile
Summary: Example code for std.stdio.File fails to compile
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-13 07:48 UTC by Walter Bright
Modified: 2017-04-18 09:39 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2017-04-13 07:48:46 UTC
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))
Comment 1 Walter Bright 2017-04-13 08:13:27 UTC
This seems to be an issue with my local copy of std.stdio seems to be behind the master.
Comment 2 Walter Bright 2017-04-18 09:39:07 UTC
I'm going to abandon this.