+ test for mantis #16582 (already works with FPC 2.6.4)

git-svn-id: trunk@30909 -
This commit is contained in:
Jonas Maebe 2015-05-25 12:55:44 +00:00
parent caea5ac8be
commit 00b68dfd9f
2 changed files with 76 additions and 0 deletions

1
.gitattributes vendored
View File

@ -13854,6 +13854,7 @@ tests/webtbs/tw16366.pp svneol=native#text/plain
tests/webtbs/tw16377.pp svneol=native#text/plain
tests/webtbs/tw16402.pp svneol=native#text/plain
tests/webtbs/tw1658.pp svneol=native#text/plain
tests/webtbs/tw16582.pp svneol=native#text/plain
tests/webtbs/tw16592.pp svneol=native#text/plain
tests/webtbs/tw16622.pp svneol=native#text/pascal
tests/webtbs/tw16668.pp svneol=native#text/plain

75
tests/webtbs/tw16582.pp Normal file
View File

@ -0,0 +1,75 @@
program Project1;
{$mode objfpc}{$H+}
{$inline on}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, sysutils;
type
{ T1 }
generic T1<_T> = class
private
i:_T;
procedure SetF(v:_T);
function GetF:_T;
end;
TPointerList = specialize T1<Pointer>;
{ TPointerList2 }
generic TPointerList2<_T2> = class(TPointerList)
public
procedure SetF(v:_T2);//inline; //when uncommented gives error - Illegal expression.
procedure WriteLn;
end;
TPointerListInt = specialize TPointerList2<PInteger>;
TPointerListDouble = specialize TPointerList2<PDouble>;
{ T1 }
procedure T1.SetF(v: _T);
begin
i:=v;
end;
function T1.GetF: _T;
begin
Result:=i;
end;
{ TPointerList2 }
procedure TPointerList2.SetF(v: _T2); inline;
begin
inherited SetF( Pointer(v) );
end;
procedure TPointerList2.WriteLn;
var S:string;
begin
S:=Format('%P', [i] );
System.WriteLn(S);
end;
var IntO:TPointerListInt;
DoubleO:TPointerListDouble;
begin
IntO:=TPointerListInt.Create;
IntO.SetF( PInteger(nil) );
IntO.WriteLn;
IntO.Free;
DoubleO:=TPointerListDouble.Create;
DoubleO.SetF( PDouble(nil) );
DoubleO.WriteLn;
DoubleO.Free;
end.