+ new tests for static troubles

This commit is contained in:
pierre 2003-01-21 11:55:14 +00:00
parent 30d8d499de
commit 6e0c3e9005
3 changed files with 103 additions and 0 deletions

19
tests/webtbs/tw2317.pp Normal file
View File

@ -0,0 +1,19 @@
{ Source provided for Free Pascal Bug Report 2317 }
{ Submitted by "Sergey Kosarevsky" on 2003-01-09 }
{ e-mail: netsurfer@au.ru }
{$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
tests/webtbs/tw2318.pp Normal file
View File

@ -0,0 +1,40 @@
{ Source provided for Free Pascal Bug Report 2318 }
{ Submitted by "Sergey Kosarevsky" on 2003-01-09 }
{ e-mail: netsurfer@au.ru }
{$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
tests/webtbs/tw2318b.pp Normal file
View File

@ -0,0 +1,44 @@
{ %RESULT=210 }
{ Source provided for Free Pascal Bug Report 2318 }
{ Submitted by "Sergey Kosarevsky" on 2003-01-09 }
{ e-mail: netsurfer@au.ru }
{$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.