Skip to content

Commit 882a1fb

Browse files
committed
Fix issue #8471 - allow only pointers as readf parameters
1 parent db204e0 commit 882a1fb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`std.stdio.readf` now only accepts pointers as input arguments.
2+

std/stdio.d

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ module std.stdio;
1616
public import core.stdc.stdio;
1717
import core.stdc.stddef; // wchar_t
1818
import std.algorithm.mutation; // copy
19+
import std.meta; // allSatisfy
1920
import std.range.primitives; // ElementEncodingType, empty, front,
2021
// isBidirectionalRange, isInputRange, put
2122
import std.stdiobase;
22-
import std.traits; // isSomeChar, isSomeString, Unqual
23+
import std.traits; // isSomeChar, isSomeString, Unqual, isPointer
2324
import std.typecons; // Flag
2425

25-
2626
/++
2727
If flag $(D KeepTerminator) is set to $(D KeepTerminator.yes), then the delimiter
2828
is included in the strings returned.
@@ -1769,6 +1769,7 @@ is recommended if you want to process a complete file.
17691769
* $(REF formattedRead, std,_format).
17701770
*/
17711771
uint readf(Data...)(in char[] format, Data data)
1772+
if (allSatisfy!(isPointer, Data))
17721773
{
17731774
import std.format : formattedRead;
17741775

@@ -3646,6 +3647,7 @@ void writefln(T...)(T args)
36463647
* $(REF formattedRead, std,_format).
36473648
*/
36483649
uint readf(A...)(in char[] format, A args)
3650+
if (allSatisfy!(isPointer, A))
36493651
{
36503652
return stdin.readf(format, args);
36513653
}

0 commit comments

Comments
 (0)