Why the "TPointer<T> = ^T;" raises an error? And what is the correct way?
Generic pointers are not supported. (Though I am playing with the tought to support them considering that arrays are supported as well).
As a workaround you can use a type inside a generic record:
{$mode delphi}
{$modeswitch advancedrecords}
type
TPointer<T> = record
type
PT = ^T;
end;
procedure Test1<T>(A: TPointer<T>.PT);
begin
Writeln(HexStr(A));
end;
var
l: LongInt;
p: PLongInt;
begin
p := @l;
Test1<LongInt>(p);
end.
Also when I write "TPointer<T> = ^T;", FPC raise the error at line of Test1, and it most probably is a bug.
Please report that as a bug.