Delphi Error – E2572 RTTI visibility set constant expression of type System.TRttiVisibility expected

Delphi Compiler Error

E2572 RTTI visibility set constant expression of type System.TRttiVisibility expected

Reason for the Error & Solution

This occurs when using the $RTTI directive with expressions that are not from System.TRttiVisibility.

program E2572;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  {$RTTI INHERIT METHODS(vtInteger)} //E2572
  TClass1 = class
    A: String;
  end;

  {$RTTI INHERIT FIELDS(vtInteger)} //E2572
  TClass2 = class
    A: String;
  end;

  {$RTTI INHERIT PROPERTIES(vtInteger)} //E2572
  TClass3 = class
    A: String;
  end;
begin

end.

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...