type aliases in records/classes cannot be used as fields without specialization
Original Reporter info from Mantis: sysrpl
-
Reporter name: Anthony Walter
Original Reporter info from Mantis: sysrpl
- Reporter name: Anthony Walter
Description:
In delphi mode when defining a generic type, type aliases cannot be used in a record or class without specialization.
In the "Step To Reproduce" example you can declare a class with a field of type "TCompare&LtPos;T>" but not of type "TListCompare".
There should be no error as TListCompare is equivalent to TCompare&LtPos;T>.
Steps to reproduce:
program genericbug;
{$mode delphi}
type
TCompare<T> = function(const A, B: T): Integer;
TList<T> = class
public
type TListCompare = TCompare<T>;
private
{$define bug}
{$ifdef bug}
{Error: Generics without specialization cannot be used as a type for a variable}
FComparer: TListCompare;
{$else}
FComparer: TCompare<T>;
{$endif}
public
property Comparer: TListCompare read FComparer write FComparer;
end;
begin
end.
Mantis conversion info:
- Mantis ID: 25236
- OS: Windows 7 64bit
- Build: trunk
- Platform: Windows
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 27861 (#639a59df)