E2133 TYPEINFO standard function expects a type identifier (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

You have attempted to obtain type information for an identifier which does not represent a type.


program Produce;

  var
    p : Pointer;

  procedure NotType;
  begin
  end;


begin
  p := TypeInfo(NotType);
end.

The TypeInfo standard procedure requires a type identifier as it's parameter. In the code above, 'NotType' does not represent a type identifier.


program Solve;

  type
    Base = class
    end;

  var
    p : Pointer;

begin
  p := TypeInfo(Base);
end.

By ensuring that the parameter used for TypeInfo is a type identifier, you will avoid this error.