HomeDelphiDelphi Error – E2134 Type ‘%s’ has no type info

Delphi Error – E2134 Type ‘%s’ has no type info

Delphi Compiler Error

E2134 Type ‘%s’ has no type info

Reason for the Error & Solution

You have applied the TypeInfo standard procedure to a type identifier which does not have any run-time type information associated with it.

program Produce;

  type
    Data = record
    end;

  var
    v : Pointer;

begin
  v := TypeInfo(Data);
end.

Record types do not generate type information, so this use of TypeInfo is illegal.

program Solve;

  type
    Base = class
    end;

  var
    v : Pointer;

begin
  v := TypeInfo(Base);
end.

A class does generate RTTI, so the use of TypeInfo here is perfectly legal.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...