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

Support assigning one nested procvar to another even when the nestedprocvars modeswitch is not active. This can happen when the type was declared in a different unit that was compiled with this modeswitch, or in internally generated wrapper code (which uses "pure" objfpc mode)
42 lines
550 B
ObjectPascal
42 lines
550 B
ObjectPascal
{$mode objfpc}
|
|
{$modeswitch nestedprocvars}
|
|
|
|
type
|
|
TNestedProc = procedure is nested;
|
|
|
|
IInf = interface
|
|
procedure InfMethod(AParam: TNestedProc);
|
|
end;
|
|
|
|
TObj = class(TInterfacedObject, IInf)
|
|
procedure InfMethod(AParam: TNestedProc);
|
|
end;
|
|
|
|
const
|
|
ok: boolean = false;
|
|
|
|
procedure TObj.InfMethod(AParam: TNestedProc);
|
|
begin
|
|
aParam
|
|
end;
|
|
|
|
procedure test(const i: IInf);
|
|
|
|
procedure nest;
|
|
begin
|
|
ok:=true;
|
|
end;
|
|
|
|
begin
|
|
i.InfMethod(@nest);
|
|
end;
|
|
|
|
var
|
|
i: IInf;
|
|
begin
|
|
i:= tobj.create;
|
|
test(i);
|
|
i:=nil;
|
|
halt(ord(not ok));
|
|
end.
|