My previous question was in the context of overloading opEquals. Here it is again in a simpler form.

void foo(const(char)[] s)
{}

void foo(const(wchar)[] s)
{}

void foo(const(dchar)[] s)
{}

void main()
{
    foo("hello");
}


Compilation error:

deneme.d(10024): Error: function deneme.foo called with argument types:
        ((string))
matches both:
        deneme.foo(const(char)[] s)
and:
        deneme.foo(const(dchar)[] s)


Adding overloads for string, wstring, and dstring does not help. Same problem...

Replacing "hello" with either of "hello"c, "hello"w, or "hello"d fixes the issue.

This is a bug, right? I've been assuming that unqualified string literals were immutable char arrays, but the behavior is different between "hello" vs. "hello"c.

Am I missing something?

Thank you,
Ali

Reply via email to