[Issue 2367] New: Overloading error

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Sep 20 12:55:38 PDT 2008


On Sat, Sep 20, 2008 at 3:10 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Jarrett Billingsley wrote:
>>
>> On Sat, Sep 20, 2008 at 2:01 PM,  <d-bugmail at puremagic.com> wrote:
>>>
>>> http://d.puremagic.com/issues/show_bug.cgi?id=2367
>>>
>>>          Summary: Overloading error
>>>          Product: D
>>>          Version: unspecified
>>>         Platform: PC
>>>       OS/Version: Linux
>>>           Status: NEW
>>>         Severity: normal
>>>         Priority: P2
>>>        Component: DMD
>>>       AssignedTo: bugzilla at digitalmars.com
>>>       ReportedBy: andrei at metalanguage.com
>>>
>>>
>>> The following code does not compile:
>>>
>>> struct S {
>>>   void foo(in char[] s) {}
>>>   void foo(in dchar[] s) {}
>>> }
>>>
>>> void main(string[] args) {
>>>   S s;
>>>   s.foo("a");
>>> }
>>>
>>> The second overload should not even be considered.
>>
>> "string literals" do not have a type; they are, in some ways,
>> polysemous.  They are considered char[], wchar[], or dchar[] based on
>> where they're used.  If they're used in a situation where it could go
>> either way (such as this overloading case), it's an error.
>>
>> The solution is simple: affix a 'c', 'w', or 'd' to the end of the
>> string literal to give it an explicit type.
>
> To facilitate archiving, you may want to post replies to the website
> instead.
>
> Andrei
>

Well that's weird, I could have sworn that replies posted to the NG
thread were mirrored on bugzilla.  Maybe it's a bug in the puremagic
mailing lists?


More information about the Digitalmars-d-bugs mailing list