mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:49:39 +02:00
+ test for "@procvar_of_object <> nil" in delphi mode
This commit is contained in:
parent
e3eb4f8359
commit
cb8f28f93d
39
tests/tbs/tb0477.pp
Normal file
39
tests/tbs/tb0477.pp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
type
|
||||||
|
TProc = procedure of object;
|
||||||
|
|
||||||
|
TTest = class
|
||||||
|
public
|
||||||
|
proc: TProc;
|
||||||
|
constructor Create;
|
||||||
|
procedure foo;
|
||||||
|
procedure bar;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TTest.Create;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
proc := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTest.foo;
|
||||||
|
begin
|
||||||
|
writeln('foo');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTest.bar;
|
||||||
|
begin
|
||||||
|
if @proc <> nil then proc;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
t: TTest;
|
||||||
|
|
||||||
|
begin
|
||||||
|
t := TTest.Create;
|
||||||
|
t.proc := t.foo;
|
||||||
|
t.bar;
|
||||||
|
t.Free;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user