RAD Studio Athens

E2176

Go Up to Error and Warning Messages (Delphi)

<typename> is not an allowed type in an OLE automation section. Only a small subset of all the valid Delphi language types are allowed in automation sections.


program Produce;

  type
    Base = class
      function GetCย : Char;
      procedure SetC(cย : Char);
    automated
      property Chย : Char read GetC write SetC dispid 151;
    end;

  procedure Base.SetC(cย : Char);
  begin
  end;

  function Base.GetCย : Char;
  begin GetCย := '!';
  end;

begin
end.

Since the character type is not one allowed in the 'automated' section, the declaration of 'Ch' will produce an error when compiled.


program Solve;

  type
    Base = class
      function GetCย : String;
      procedure SetC(cย : String);
    automated
      property Chย : String read GetC write SetC dispid 151;
    end;

  procedure Base.SetC(cย : String);
  begin
  end;

  function Base.GetCย : String;
  begin GetCย := '!';
  end;

begin
end.

There are two solutions to this problem. The first is to move the offending declaration out of the 'automated' section. The second is to change the offending type to one that is allowed in 'automated' sections.