RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2122: PROCEDURE or FUNCTION expected (Delphi)

This error message is produced by two different constructs, but in both cases the compiler is expecting to find the keyword 'procedure' or the keyword 'function'.

program Produce;

  type
    Base = class
      class AProcedure; (*case 1*)
    end;

  class Base.AProcedure; (*case 2*)
  begin
  end;

begin
end.

In both cases above, the word 'procedure' should follow the keyword 'class'.

program Solve;

  type
    Base = class
      class procedure AProcedure;
    end;

  class procedure Base.AProcedure;
  begin
  end;

begin
end.

As can be seen, adding the keyword 'procedure' removes the error from this program.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!