When trying to assign procedure begin end to a TProc in the code below,
I get a compiler error:
E2441 Inline function declared in interface section must not use local symbol '.TMyClass.DoesNotCompile$ActRec'
unit Unit1;
interface
uses
System.SysUtils;
type
TMyClass = class
procedure Compiles<T>; inline;
procedure DoesNotCompile; inline;
end;
implementation
procedure TMyClass.Compiles<T>;
var
m: TProc;
begin
m := procedure begin end; //<== works
end;
procedure TMyClass.DoesNotCompile;
var
m: TProc;
begin
m := procedure begin end; //<== compiler error
end;
end.
I would expect the generic and non-generic versions to behave in the same way. What is the difference, and: is it safe to use the generic version?
I'm using Delphi 11.1 Alexandria.