[Issue 4883] std.algorithm functions conflict with std.string fucntions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 9 09:21:52 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4883


Per Ångström <d-bugzilla at autark.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d-bugzilla at autark.se


--- Comment #2 from Per Ångström <d-bugzilla at autark.se> 2010-11-09 09:20:47 PST ---
(Digital Mars D Compiler v2.050)
I get the same error message without even importing std.string:

$ cat count.d
import std.algorithm;
void main()
{
    string str = "abc";
    int i = str.count("ab");

}

$ dmd count.d 
/usr/include/d/dmd/phobos/std/functional.d(176): Error: static assert  "Bad
binary function q{a == b}. You need to use a valid D expression using symbols a
of type dchar and b of type string."
/usr/include/d/dmd/phobos/std/functional.d(179):        instantiated from here:
Body!(dchar,string)
/usr/include/d/dmd/phobos/std/algorithm.d(3300):        instantiated from here:
result!(dchar,string)
count.d(5):        instantiated from here: count!("a == b",string,string)
Even though I don't expect the program to compile successfully, I find it odd
that the compiler picks up std.algorithm.count at all, when I'm using the
object.member notation.

-- 
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