mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 19:49:22 +02:00
* fixed overloading of div operator
git-svn-id: trunk@3513 -
This commit is contained in:
parent
da32415fc9
commit
281d6907d2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6779,6 +6779,7 @@ tests/webtbs/tw4574.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw4599.pp svneol=native#text/plain
|
tests/webtbs/tw4599.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw4613.pp -text svneol=unset#text/plain
|
tests/webtbs/tw4613.pp -text svneol=unset#text/plain
|
||||||
tests/webtbs/tw4616.pp svneol=native#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/tw4632.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw4633.pp svneol=native#text/plain
|
tests/webtbs/tw4633.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw4634.pp -text
|
tests/webtbs/tw4634.pp -text
|
||||||
|
@ -149,6 +149,18 @@ implementation
|
|||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
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 }
|
{ we need 2 orddefs always }
|
||||||
if (left.resulttype.def.deftype<>orddef) then
|
if (left.resulttype.def.deftype<>orddef) then
|
||||||
inserttypeconv(right,sinttype);
|
inserttypeconv(right,sinttype);
|
||||||
@ -172,18 +184,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
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 }
|
{ 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) }
|
{ 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 }
|
{ Do the same for qwords and positive constants as well, otherwise things like }
|
||||||
|
16
tests/webtbs/tw4624.pp
Normal file
16
tests/webtbs/tw4624.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user