Skip to content

Commit

Permalink
Fix issue #8471 - allow only pointers as readf parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
byebye committed Jan 30, 2017
1 parent db204e0 commit 882a1fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog/std-stdio-readf-only-pointers.dd
@@ -0,0 +1,2 @@
`std.stdio.readf` now only accepts pointers as input arguments.

6 changes: 4 additions & 2 deletions std/stdio.d
Expand Up @@ -16,13 +16,13 @@ module std.stdio;
public import core.stdc.stdio;
import core.stdc.stddef; // wchar_t
import std.algorithm.mutation; // copy
import std.meta; // allSatisfy
import std.range.primitives; // ElementEncodingType, empty, front,
// isBidirectionalRange, isInputRange, put
import std.stdiobase;
import std.traits; // isSomeChar, isSomeString, Unqual
import std.traits; // isSomeChar, isSomeString, Unqual, isPointer
import std.typecons; // Flag


/++
If flag $(D KeepTerminator) is set to $(D KeepTerminator.yes), then the delimiter
is included in the strings returned.
Expand Down Expand Up @@ -1769,6 +1769,7 @@ is recommended if you want to process a complete file.
* $(REF formattedRead, std,_format).
*/
uint readf(Data...)(in char[] format, Data data)
if (allSatisfy!(isPointer, Data))
{
import std.format : formattedRead;

Expand Down Expand Up @@ -3646,6 +3647,7 @@ void writefln(T...)(T args)
* $(REF formattedRead, std,_format).
*/
uint readf(A...)(in char[] format, A args)
if (allSatisfy!(isPointer, A))
{
return stdin.readf(format, args);
}
Expand Down

0 comments on commit 882a1fb

Please sign in to comment.