E2501 Inline function cannot call nested routine '%s' (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

This happens when using a nested function inside an inline function.

program E2501;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  UE2501 in 'UE2501.pas';

begin
  {E2501 Inline function cannot call nested routine '%s'}
end.

Unit where the inline function with the nested method is defined:

unit UE2501;

interface
procedure Foo; inline;
implementation
procedure Foo;
    procedure Bar;
    begin
    end;

  begin
    Bar(); //E2501 Fix: change the containing function to a regular function
  end;
end.