* always demote type conversions which cannot represent part of the

source value to convert_l3, instead of only those with a destination
    type whose size is < source size (like Delphi) + test -> fixes
    toperator6 along with a host of wrong tordconst typeconversions in
    the compiler sources themselves (although most are harmless)

git-svn-id: trunk@8323 -
This commit is contained in:
Jonas Maebe 2007-08-28 19:38:40 +00:00
parent ffbb833805
commit 5bc156efea
3 changed files with 27 additions and 5 deletions

1
.gitattributes vendored
View File

@ -6938,6 +6938,7 @@ tests/test/toperator5.pp svneol=native#text/plain
tests/test/toperator6.pp svneol=native#text/plain
tests/test/tover1.pp svneol=native#text/plain
tests/test/tover2.pp svneol=native#text/plain
tests/test/tover3.pp svneol=native#text/plain
tests/test/tpackrec.pp svneol=native#text/plain
tests/test/tpara1.pp svneol=native#text/plain
tests/test/tpara2.pp svneol=native#text/plain

View File

@ -250,12 +250,10 @@ implementation
doconv:=basedefconvertsimplicit[basedeftbl[torddef(def_from).ordtype],basedeftbl[torddef(def_to).ordtype]];
if (doconv=tc_not_possible) then
eq:=te_incompatible
else
else if (not is_in_limit(def_from,def_to)) then
{ "punish" bad type conversions :) (JM) }
if (not is_in_limit(def_from,def_to)) and
(def_from.size > def_to.size) then
eq:=te_convert_l3
else
eq:=te_convert_l3
else
eq:=te_convert_l1;
end;
end;

23
tests/test/tover3.pp Normal file
View File

@ -0,0 +1,23 @@
{ %fail }
procedure t1(l: longint); overload;
begin
writeln('longint');
end;
procedure t1(l: smallint); overload;
begin
writeln('smallint');
end;
procedure t1(l: word); overload;
begin
writeln('word');
end;
var
c: cardinal;
begin
c:=1;
t1(c);
end.