I'm not sure whether the following a compiler/language bug or a Phobos
bug, but it's definitely some kind of bug:

        auto s = "abc";
        immutable t = "def";

        writeln(typeid(s));     // immutable(char)[]
        writeln(typeid(t));     // immutable(immutable(char)[])
                                // (what is this supposed to mean?!)

        char ch = 'c';
        bool b = canFind(s, ch);        // OK
        bool c = canFind(t, ch);        // Compile error??

The compile error is:

test.d:11: Error: template std.algorithm.canFind(alias pred = "a == b",Range,V) 
if (is(typeof(find!(pred)(range,value)))) does not match any function template 
declaration
test.d:11: Error: template std.algorithm.canFind(alias pred = "a == b",Range,V) 
if (is(typeof(find!(pred)(range,value)))) cannot deduce template function from 
argument types !()(immutable(char[]),char)

Can somebody explain what's going on here?


T

-- 
There are two ways to write error-free programs; only the third one works.

Reply via email to