A generic class cannot be specialized if one of its functions contains "System.Something" access code.
Original Reporter info from Mantis: SIV
-
Reporter name: Igor Sudarikov
Original Reporter info from Mantis: SIV
- Reporter name: Igor Sudarikov
Description:
The following code fails to compile:
{$mode objfpc}
uses Test;
type
TIntegerSmartArray = specialize GSmartArray<Integer>;
begin
end.
"Test" unit code is provided in "Additional Information". The error happens only when trying to specialize GSmartArray from other unit (TBooleanSmartArray in "Test" works fine)
Additional information:
unit Test;
{$mode objfpc}
interface
type
generic GSmartArray<TSomeType> = class
private
fItems :array of TSomeType;
public
function Length() :Integer;
end;
TBooleanSmartArray = specialize GSmartArray<Boolean>;
implementation
function GSmartArray.Length() :Integer;
begin
Result := System.Length(fItems);
end;
end.
Mantis conversion info:
- Mantis ID: 15591
- Build: 14777
- Version: 2.5.1
- Fixed in version: 2.6.0
- Fixed in revision: 16489 (#668cd1f3)
- Monitored by: » alexionne (Aleksa Todorovic), » merlin2100 (Merlin Green)