[fpc-devel] Bug in FPC and declaring distinct types

Florian Klaempfl florian at freepascal.org
Thu Sep 18 15:40:10 CEST 2008


Yury Sidorov schrieb:
> From: "Florian Klaempfl" <florian at freepascal.org>
> To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
> Sent: Thursday, September 18, 2008 4:14 PM
> Subject: Re: [fpc-devel] Bug in FPC and declaring distinct types
> 
> 
>> Yury Sidorov schrieb:
>>>>> Yes. But it works only partially. For example the following code is 
>>>>> not compilable:
>>>>
>>>> Well, I wouldn't know either what you expect :)
>>>
>>> I expect that compiler will choose DoTest with ansistring parameter 
>>> in that case.
>>
>> What rule do you apply to say this?
> 
> Compiler treats '1234' as ansistring constant. Therefore ansistring 
> overload must be choosen here.

No, '1234' is taken as generic string constant.

> 
> Like in this case:
> 
> const
>  sss: ansistring = '1234';
> ...
> DoTest(sss);
> 
> 
>>>>> //------
>>>>> type
>>>>>  TUTF8String = type ansistring;
>>>>>
>>>>> procedure DoTest(const s: ansistring); overload;
>>>>> begin
>>>>> end;
>>>>>
>>>>> procedure DoTest(const s: TUTF8String); overload;
>>>>> begin
>>>>> end;
>>>>>
>>>>> begin
>>>>>  DoTest('1234');
>>>>> end.
>>>>>
>>>>> //------
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list