Section 8.5.5 of the reference guide, "Scope considerations" regarding generic type declarations, is simply incorrect.
Original Reporter info from Mantis: Akira1364
-
Reporter name:
Original Reporter info from Mantis: Akira1364
- Reporter name:
Description:
It says that only {$mode Delphi} allows use of specializaions that have not been explicitly declared with type aliases. However, that is not true. The following example compiles and works:
program Test;
{$mode ObjFPC}
{$modeswitch AdvancedRecords}
type
generic TTest<T> = record
Value: T;
class function Create(const AT: T): TTest; static; inline;
end;
class function TTest.Create(const AT: T): TTest;
begin
Result.Value := AT;
end;
var T: specialize TTest<LongInt>;
begin
T := specialize TTest<LongInt>.Create(1);
WriteLn(T.Value);
end.
Steps to reproduce:
None relevant as it is documentation.
Mantis conversion info:
- Mantis ID: 35012
- OS: Windows
- OS Build: 10
- Build: Trunk
- Platform: x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 1559 (#85069616)
- Target version: 3.2.0