Browse Source

+ new tests for static troubles

pierre 22 years ago
parent
commit
6e0c3e9005
3 changed files with 103 additions and 0 deletions
  1. 19 0
      tests/webtbs/tw2317.pp
  2. 40 0
      tests/webtbs/tw2318.pp
  3. 44 0
      tests/webtbs/tw2318b.pp

+ 19 - 0
tests/webtbs/tw2317.pp

@@ -0,0 +1,19 @@
+{ Source provided for Free Pascal Bug Report 2317 }
+{ Submitted by "Sergey Kosarevsky" on  2003-01-09 }
+{ e-mail: [email protected] }
+
+{$static on}
+
+Type tObject=Object
+        Function GetVMT:Pointer;Static;
+     End;
+
+Function tObject.GetVMT:Pointer;
+Begin
+   Exit(TypeOf(Self));
+End;
+
+Begin
+   WriteLn(Longint(tObject.GetVMT()));
+End.
+

+ 40 - 0
tests/webtbs/tw2318.pp

@@ -0,0 +1,40 @@
+{ Source provided for Free Pascal Bug Report 2318 }
+{ Submitted by "Sergey Kosarevsky" on  2003-01-09 }
+{ e-mail: [email protected] }
+
+{$static on}
+
+Type tObject=Object
+        Constructor Init;
+        Function GetVMT:Pointer;Static;
+        Destructor Done;Virtual;
+     End;
+
+Constructor tObject.Init;
+Begin
+End;
+
+
+Function tObject.GetVMT:Pointer;
+Begin
+  GetVMT:=Typeof(self);
+End;
+
+
+Destructor tObject.Done;
+Begin
+End;
+
+Var O:tObject;
+
+Begin
+   O.Init;
+   if (O.GetVMT= nil) or (O.getVMT<>tObject.GetVMT) then
+     begin
+       Writeln('Problem with static methods');
+       Writeln('O.getVMT=',hexstr(longint(O.getVMT),8));
+       Writeln('tObject.GetVMT=',hexstr(longint(tobject.GetVMT),8));
+       halt(1);
+     end;
+End.
+

+ 44 - 0
tests/webtbs/tw2318b.pp

@@ -0,0 +1,44 @@
+{ %RESULT=210 }
+
+{ Source provided for Free Pascal Bug Report 2318 }
+{ Submitted by "Sergey Kosarevsky" on  2003-01-09 }
+{ e-mail: [email protected] }
+
+{$static on}
+
+{$R+}
+
+Type tObject=Object
+        Constructor Init;
+        Function GetVMT:Pointer;Static;
+        Destructor Done;Virtual;
+     End;
+
+Constructor tObject.Init;
+Begin
+End;
+
+Function tObject.GetVMT:Pointer;
+Begin
+  GetVMT:=Typeof(self);
+End;
+
+
+Destructor tObject.Done;
+Begin
+End;
+
+Var O:tObject;
+
+Begin
+   //O.Init;
+   { No init done,
+     the object check should give an RTE 210 }
+
+   if (O.GetVMT= nil) or (O.getVMT<>tObject.GetVMT) then
+     begin
+       Writeln('Problem with static methods');
+       halt(1);
+     end;
+End.
+