Browse Source

+ check for record operator overloading

pierre 23 years ago
parent
commit
ca424bbc32
1 changed files with 28 additions and 0 deletions
  1. 28 0
      tests/webtbs/tw1223.pp

+ 28 - 0
tests/webtbs/tw1223.pp

@@ -0,0 +1,28 @@
+{ Source provided for Free Pascal Bug Report 1223 }
+{ Submitted by "Denis Yarkovoy" on  2000-11-03 }
+{ e-mail: [email protected] }
+ Type
+      TPoint = record
+       X, Y : integer;
+      end;
+
+ operator + (const p1, p2:TPoint) p : TPoint;
+ begin
+  p.X:=p1.X+p2.X;
+  p.Y:=p1.Y+p2.Y;
+ end;
+
+ var d,d1:TPoint;
+
+begin
+  d.x:=5;d.y:=34;
+  d1.x:=6;d1.y:=-50;
+  d:=d+d1;
+  if (d.x<>11) or (d.y<>-16) then
+    begin
+      Writeln('Error is operator overloading');
+      Halt(1);
+    end
+  else
+    Writeln('Operator overloading works correctly');
+end.