mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-23 03:29:18 +02:00
Merged revisions 983 via svnmerge from
/trunk git-svn-id: branches/fixes_2_0@1012 -
This commit is contained in:
parent
7d52f0d3cc
commit
b639762949
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6007,6 +6007,7 @@ tests/webtbs/tw4240.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4247.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4253.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4260.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4272.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4277.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4294.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4308.pp svneol=native#text/plain
|
||||
|
@ -304,23 +304,35 @@ implementation
|
||||
else
|
||||
begin
|
||||
doconv:=tc_string_2_string;
|
||||
if tstringdef(def_from).string_typ=st_widestring then
|
||||
begin
|
||||
{ Prefer conversions to shortstring over other
|
||||
conversions. This is compatible with Delphi (PFV) }
|
||||
if tstringdef(def_to).string_typ=st_shortstring then
|
||||
eq:=te_convert_l3
|
||||
else
|
||||
eq:=te_convert_l2;
|
||||
end
|
||||
else
|
||||
{ Prefer shortstrings of different length or conversions
|
||||
from shortstring to ansistring }
|
||||
if (tstringdef(def_from).string_typ=st_shortstring) and
|
||||
(tstringdef(def_to).string_typ in [st_shortstring,st_ansistring]) then
|
||||
eq:=te_convert_l1
|
||||
else
|
||||
eq:=te_convert_l2;
|
||||
case tstringdef(def_from).string_typ of
|
||||
st_widestring :
|
||||
begin
|
||||
{ Prefer conversions to ansistring }
|
||||
if tstringdef(def_to).string_typ=st_ansistring then
|
||||
eq:=te_convert_l2
|
||||
else
|
||||
eq:=te_convert_l3;
|
||||
end;
|
||||
st_shortstring :
|
||||
begin
|
||||
{ Prefer shortstrings of different length or conversions
|
||||
from shortstring to ansistring }
|
||||
if (tstringdef(def_to).string_typ=st_shortstring) then
|
||||
eq:=te_convert_l1
|
||||
else if tstringdef(def_to).string_typ=st_ansistring then
|
||||
eq:=te_convert_l2
|
||||
else
|
||||
eq:=te_convert_l3;
|
||||
end;
|
||||
st_ansistring :
|
||||
begin
|
||||
{ Prefer conversion to widestrings }
|
||||
if (tstringdef(def_to).string_typ=st_widestring) then
|
||||
eq:=te_convert_l2
|
||||
else
|
||||
eq:=te_convert_l3;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
orddef :
|
||||
|
16
tests/webtbs/tw4272.pp
Executable file
16
tests/webtbs/tw4272.pp
Executable file
@ -0,0 +1,16 @@
|
||||
procedure go(const w: widestring);overload;
|
||||
begin
|
||||
writeln('wide: ',w);
|
||||
end;
|
||||
|
||||
procedure go(const w: shortstring);overload;
|
||||
begin
|
||||
writeln('short: ',w);
|
||||
end;
|
||||
|
||||
var
|
||||
s: ansistring;
|
||||
begin
|
||||
s:='test';
|
||||
go(s); //-->compiler can not determine whitch overloaded function to call
|
||||
end.
|
Loading…
Reference in New Issue
Block a user