ambiguation between char[] and dchar[]

mandel foo at bar.com
Mon Jul 9 19:58:08 PDT 2007


Hi,

recently I stumbled over the problem where I call put("hello") on a library class
but got something equivalent to this:
Test.d(158): function Test.put called with argument types:
        (char[4])
matches both:
        Test.put(dchar[])
and:
        Test.put(wchar[])

The reason is obviously that class Test implements put(char[] s) and put(dchar[] s) but also put(wchar[] s).
Interestingly put(wchar[] s) isn't considered as ambiguous.

The simple solution would be to call put("hello"c), but it's also quite tedious.
I tend to forget is as often as the ';' behind class definitions in C++.

I think the default interpretation of an string should be char[]
as the compiler output suggests "(char[4])", but apparently doesn't care about.

The question is if it is a compiler bug?




More information about the Digitalmars-d mailing list