Is this a known issue in Phobos/DMD?

d coder dlang.coder at gmail.com
Sat Jan 5 08:09:13 PST 2013


Greetings

When I compile the code below, I unexpectedly get an error:
test.d(7): Error: template std.string.format does not match any function
template declaration. Candidates are:
/home/puneet/local/github-d/bin/../phobos/std/string.d(2528):
 std.string.format(Char, Args...)(in Char[] fmt, Args args)
test.d(7): Error: template std.string.format(Char, Args...)(in Char[] fmt,
Args args) cannot deduce template function from argument types
!()(string,void)

There are a couple of issues involved here.
1. std.string is exposing "count" (and some other functions) from
std.algorithm. I think this should be a bug since count is not listed as a
method in the std.string documentation.
2. Now the function from std.algorithm that becomes visible, shadows the
local argument count. Is this expected behavior? If not, has it already
been reported as a bug? At the minimum I expect better error message here.

Thanks and Regards
- Puneet


void main() {                   // 1
  foo(4);                       // 2
}                               // 3
                                // 4
void foo(int count) {           // 5
  import std.string;            // 6
  format("%s", count);          // 7
}                               // 8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130105/0e93cbe7/attachment.html>


More information about the Digitalmars-d mailing list