[Issue 10571] New: formattedWrite error with delegate and string
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 8 04:53:06 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10571
Summary: formattedWrite error with delegate and string
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: yebblies at gmail.com
--- Comment #0 from yebblies <yebblies at gmail.com> 2013-07-08 21:53:05 EST ---
I can't format a string into a delegate taking a 'const char[]'. This seems
wrong to me.
----------------------------------
import std.format;
void main()
{
string buf;
formattedWrite((in char[] s) { buf ~= s; }, "%s", "hello");
assert(buf == "hello");
}
----------------------------------
DMD v2.064 DEBUG
F:\documents\desktop\d\sourcecode\phobos\std\range.d(611): Error: static assert
"Cannot put a dchar into a void delegate(const(char[])) nothrow @safe"
F:\documents\desktop\d\sourcecode\phobos\std\format.d(1752):
instantiated from here: put!(void delegate(const(char[])) nothrow @safe, dchar)
F:\documents\desktop\d\sourcecode\phobos\std\format.d(2146):
instantiated from here: formatValue!(void delegate(const(char[])) nothrow
@safe, dchar, char)
F:\documents\desktop\d\sourcecode\phobos\std\format.d(1790):
instantiated from here: formatRange!(void delegate(const(char[])) nothrow
@safe, string, char)
F:\documents\desktop\d\sourcecode\phobos\std\format.d(2996): ... (1
instantiations, -v to show) ...
F:\documents\desktop\d\sourcecode\phobos\std\format.d(420):
instantiatedfrom here: formatGeneric!(void delegate(const(char[])) nothrow
@safe, string, char)
testx.d(7): instantiated from here: formattedWrite!(void
delegate(const(char[]) s) nothrow @safe, char, string)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list