mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 01:08:07 +02:00
29 lines
387 B
ObjectPascal
29 lines
387 B
ObjectPascal
{ %FAIL }
|
|
|
|
{ an anonymous function referencing Self can not be assigned to a procedure
|
|
variable }
|
|
|
|
program tanonfunc9;
|
|
|
|
{$mode objfpc}
|
|
{$modeswitch anonymousfunctions}
|
|
|
|
type
|
|
TTestFunc = function: LongInt;
|
|
|
|
TTest = class
|
|
f: LongInt;
|
|
procedure Test;
|
|
end;
|
|
|
|
procedure TTest.Test;
|
|
var
|
|
tf: TTestFunc;
|
|
begin
|
|
tf := function: LongInt begin Result := f; end;
|
|
end;
|
|
|
|
begin
|
|
|
|
end.
|