Mantis #25043 was fixed by partial specializations addition in revision 27861

+ added test

git-svn-id: trunk@27879 -
This commit is contained in:
svenbarth 2014-06-06 15:52:02 +00:00
parent 6f962e817a
commit 94f47443f0
2 changed files with 80 additions and 0 deletions

1
.gitattributes vendored
View File

@ -13887,6 +13887,7 @@ tests/webtbs/tw25004.pp svneol=native#text/pascal
tests/webtbs/tw2503.pp svneol=native#text/plain
tests/webtbs/tw25030.pp svneol=native#text/pascal
tests/webtbs/tw2504.pp svneol=native#text/plain
tests/webtbs/tw25043.pp svneol=native#text/pascal
tests/webtbs/tw25054a.pp svneol=native#text/pascal
tests/webtbs/tw25054b.pp svneol=native#text/pascal
tests/webtbs/tw25059.pp svneol=native#text/pascal

79
tests/webtbs/tw25043.pp Normal file
View File

@ -0,0 +1,79 @@
program tw25043;
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
const
TestValue = 30061978;
type
TDescendant = class(TObject)
public
function GetValue(): Integer;
end;
TCollection<E: class> = class(TObject)
protected
Value: E;
function GetElements(Index: Integer): E;
public
property Element: E read Value;
property Elements[Index: Integer]: E read GetElements; default;
end;
TDescendantCollection<E: TDescendant> = class(TCollection<E>)
public
procedure TestValues();
end;
{ TDescendant }
function TDescendant.GetValue(): Integer;
begin
Result := TestValue;
end;
{ TDescendantCollection<E> }
procedure TDescendantCollection<E>.TestValues();
begin
if Value.GetValue() <> TestValue then
Halt(1);
if Element.GetValue() <> TestValue then
Halt(1);
if GetElements(0).GetValue() <> TestValue then
Halt(1);
if Elements[0].GetValue() <> TestValue then
Halt(1);
if Self[0].GetValue() <> TestValue then
Halt(1);
end;
{ TCollection<E> }
function TCollection<E>.GetElements(Index: Integer): E;
begin
Result := Value;
end;
var
Collection: TDescendantCollection<TDescendant>;
Descendant: TDescendant;
begin
Descendant := TDescendant.Create();
Collection := TDescendantCollection<TDescendant>.Create();
Collection.Value := Descendant;
Collection.TestValues();
Collection.Free();
Descendant.Free();
end.