mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 04:48:02 +02:00

(since macpas methods may accidentally be called like that as well, as it doesn't have any constructors/destructors) + some tests for MacPas objects from the GNU Pascal testsuite git-svn-id: trunk@5421 -
30 lines
562 B
ObjectPascal
30 lines
562 B
ObjectPascal
{ original: peter5d.pas from the GNU Pascal testsuite }
|
|
|
|
{$mode macpas}
|
|
program peter5d(output);
|
|
|
|
type
|
|
obj = object
|
|
procedure Destroy;
|
|
procedure Free;
|
|
end;
|
|
|
|
procedure obj.Destroy;
|
|
begin
|
|
dispose( self );
|
|
end;
|
|
|
|
procedure obj.Free;
|
|
begin
|
|
writeln('must not be called');
|
|
halt(1);
|
|
end;
|
|
|
|
var
|
|
o: obj;
|
|
begin
|
|
new(o);
|
|
o.Destroy;
|
|
WriteLn( 'OK' );
|
|
end.
|