mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 02:50:40 +01:00
+ new tests for static troubles
This commit is contained in:
parent
30d8d499de
commit
6e0c3e9005
19
tests/webtbs/tw2317.pp
Normal file
19
tests/webtbs/tw2317.pp
Normal 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
40
tests/webtbs/tw2318.pp
Normal 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
44
tests/webtbs/tw2318b.pp
Normal 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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user