mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-20 17:49:24 +01:00
+ test for mantis #16582 (already works with FPC 2.6.4)
git-svn-id: trunk@30909 -
This commit is contained in:
parent
caea5ac8be
commit
00b68dfd9f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
75
tests/webtbs/tw16582.pp
Normal 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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user