Bug 2980 – compiler error when writefln( uint )

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-05-14T13:59:00Z
Last change time
2015-06-09T01:27:59Z
Keywords
diagnostic
Assigned to
andrei
Creator
someanon

Comments

Comment #0 by someanon — 2009-05-14T13:59:06Z
import std.stdio; int main() { uint ui; writefln(ui); return 0; } dmd error out: $ dmd structarr.d /home/zhou/project/dmd/linux/bin/../../src/phobos/std/stdio.d(518): Error: template std.format.formattedWrite(Writer,F,A...) does not match any function template declaration /home/zhou/project/dmd/linux/bin/../../src/phobos/std/stdio.d(518): Error: template std.format.formattedWrite(Writer,F,A...) cannot deduce template function from argument types !()(LockingTextWriter,uint)
Comment #1 by bugzilla — 2009-05-14T20:21:12Z
writefln() expects a format string as its first argument, not a uint. To print a value without using a format string, use writeln().
Comment #2 by braddr — 2009-05-14T20:42:48Z
reopening and turning into an enhancement request. The writefln templates could do considerably better about messaging the problem.
Comment #3 by andrei — 2009-05-14T22:19:55Z
(In reply to comment #2) > reopening and turning into an enhancement request. The writefln templates > could do considerably better about messaging the problem. Yah, I changed things such that now you'll see: /home/andrei/code/dmd/phobos/std/stdio.d(512): Error: static assert "You must pass a formatting string as the first argument to writef or writefln. If no formatting is needed, you may want to use write."
Comment #4 by andrei — 2009-08-27T14:41:02Z
Time to close this fella.