[Issue 2367] New: Overloading error

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Sep 20 13:43:46 PDT 2008


On Sat, Sep 20, 2008 at 4:35 PM, Denis Koroskin <2korden at gmail.com> wrote:
> On Sat, 20 Sep 2008 23:55:38 +0400, Jarrett Billingsley
> <jarrett.billingsley at gmail.com> wrote:
>
>> 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?
>
> No, it never used to and I like the way it is!
>
> Sometimes I express my thoughts on the subject here on purpose so that they
> don't get posted to the bugzilla (because they address some irrelevant topic
> or loosely related to the original post or not helpful all). This discussion
> is on of examples :)
>

Well well.  Color me wrong.


More information about the Digitalmars-d-bugs mailing list