HomeDelphiDelphi Error – E2574 Instantiated type can not be used for TYPE’d type declaration

Delphi Error – E2574 Instantiated type can not be used for TYPE’d type declaration

Delphi Compiler Error

E2574 Instantiated type can not be used for TYPE’d type declaration

Reason for the Error & Solution

This occurs when trying to define a type based on a generic object.

program E2574;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TGenClass<T> = class
  end;

  TClass = type TGenClass<Integer>; //E2574

type
  TGenArray<T> = array of T;
  TArray = type TGenArray<Integer>; //E2574

type
  TGenRecord<T> = record
  end;

  TRecord = type TGenRecord<Integer>; //E2574

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