mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 11:29:24 +02:00
* 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:
parent
ffbb833805
commit
5bc156efea
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
23
tests/test/tover3.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user