* correct return a pointer to the list so that List^[x] works as it did before 3.2

+ added test

git-svn-id: trunk@41938 -
This commit is contained in:
svenbarth 2019-04-26 08:13:11 +00:00
parent 639adc314f
commit b7a716cd81
3 changed files with 33 additions and 3 deletions

1
.gitattributes vendored
View File

@ -11830,6 +11830,7 @@ tests/tbs/tb0653.pp svneol=native#text/plain
tests/tbs/tb0654.pp svneol=native#text/plain
tests/tbs/tb0655.pp svneol=native#text/pascal
tests/tbs/tb0656.pp svneol=native#text/pascal
tests/tbs/tb0657.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -900,7 +900,7 @@ end;
function TFPGList.GetList: PTypeList;
begin
Result := PTypeList(FList);
Result := PTypeList(@FList);
end;
function TFPGList.ItemPtrCompare(Item1, Item2: Pointer): Integer;
@ -1035,7 +1035,7 @@ end;
function TFPGObjectList.GetList: PTypeList;
begin
Result := PTypeList(FList);
Result := PTypeList(@FList);
end;
function TFPGObjectList.ItemPtrCompare(Item1, Item2: Pointer): Integer;
@ -1165,7 +1165,7 @@ end;
function TFPGInterfacedObjectList.GetList: PTypeList;
begin
Result := PTypeList(FList);
Result := PTypeList(@FList);
end;
function TFPGInterfacedObjectList.ItemPtrCompare(Item1, Item2: Pointer): Integer;

29
tests/tbs/tb0657.pp Normal file
View File

@ -0,0 +1,29 @@
program tb0657;
{$mode objfpc}
uses
fgl;
type
TIntList = specialize TFPGList<LongInt>;
const
c = 3;
var
l: TIntList;
i: LongInt;
begin
l := TIntList.Create;
try
for i := 0 to c do
l.Add(i);
for i := 0 to l.Count - 1 do
if l.List^[i] <> i then
Halt(i + 1);
finally
l.Free;
end;
end.