* fixed overloading of div operator

git-svn-id: trunk@3513 -
This commit is contained in:
florian 2006-05-13 21:37:54 +00:00
parent da32415fc9
commit 281d6907d2
3 changed files with 29 additions and 12 deletions

1
.gitattributes vendored
View File

@ -6779,6 +6779,7 @@ tests/webtbs/tw4574.pp svneol=native#text/plain
tests/webtbs/tw4599.pp svneol=native#text/plain
tests/webtbs/tw4613.pp -text svneol=unset#text/plain
tests/webtbs/tw4616.pp svneol=native#text/plain
tests/webtbs/tw4624.pp -text svneol=unset#text/plain
tests/webtbs/tw4632.pp svneol=native#text/plain
tests/webtbs/tw4633.pp svneol=native#text/plain
tests/webtbs/tw4634.pp -text

View File

@ -149,6 +149,18 @@ implementation
if codegenerror then
exit;
result:=simplify;
if assigned(result) then
exit;
{ allow operator overloading }
t:=self;
if isbinaryoverloaded(t) then
begin
result:=t;
exit;
end;
{ we need 2 orddefs always }
if (left.resulttype.def.deftype<>orddef) then
inserttypeconv(right,sinttype);
@ -172,18 +184,6 @@ implementation
end;
end;
result:=simplify;
if assigned(result) then
exit;
{ allow operator overloading }
t:=self;
if isbinaryoverloaded(t) then
begin
result:=t;
exit;
end;
{ if one operand is a cardinal and the other is a positive constant, convert the }
{ constant to a cardinal as well so we don't have to do a 64bit division (JM) }
{ Do the same for qwords and positive constants as well, otherwise things like }

16
tests/webtbs/tw4624.pp Normal file
View File

@ -0,0 +1,16 @@
{ Source provided for Free Pascal Bug Report 4624 }
{ Submitted by "benoit sanchez" on 2005-12-20 }
{ e-mail: sanchez@clipper.ens.fr }
type Number=record
value:boolean;
end;
operator div (a,b:number) c:number;
begin
c.value:=true;
end;
var a:number;
begin
a:=a div a;
end.