mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +02:00
* Fix bug #26370: A multi-dimensional variant array is "empty" when any of its dimensions has zero range, range of other dimensions does not matter.
git-svn-id: trunk@29324 -
This commit is contained in:
parent
d2187257e7
commit
ba61a9f95c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12596,6 +12596,7 @@ tests/test/units/sysutils/twstrcmp.pp svneol=native#text/plain
|
||||
tests/test/units/ucomplex/tcsqr1.pp svneol=native#text/pascal
|
||||
tests/test/units/variants/tcustomvariant.pp svneol=native#text/plain
|
||||
tests/test/units/variants/tvararrayofintf.pp svneol=native#text/plain
|
||||
tests/test/units/variants/tw26370.pp svneol=native#text/plain
|
||||
tests/test/units/variants/tw27044.pp svneol=native#text/plain
|
||||
tests/test/uobjc24.pp svneol=native#text/plain
|
||||
tests/test/uobjc26.pp svneol=native#text/plain
|
||||
|
@ -483,13 +483,10 @@ function TVariantArrayIterator.AtEnd: Boolean;
|
||||
var
|
||||
i : sizeint;
|
||||
begin
|
||||
result:=true;
|
||||
result:=false;
|
||||
for i:=0 to Pred(Dims) do
|
||||
if Coords^[i] < Bounds^[i].LowBound + Bounds^[i].ElementCount then
|
||||
begin
|
||||
result:=false;
|
||||
exit;
|
||||
end;
|
||||
if Coords^[i] >= Bounds^[i].LowBound + Bounds^[i].ElementCount then
|
||||
result:=true;
|
||||
end;
|
||||
|
||||
{$pop}// {$r-} for TVariantArrayIterator
|
||||
|
19
tests/test/units/variants/tw26370.pp
Normal file
19
tests/test/units/variants/tw26370.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{$mode objfpc}
|
||||
uses Variants;
|
||||
|
||||
procedure test;
|
||||
var
|
||||
Bounds: Array [0..1] of TVarArrayBound;
|
||||
V1, V2: Variant;
|
||||
begin
|
||||
Bounds[0].lowbound := 0;
|
||||
Bounds[0].elementcount := 1;
|
||||
Bounds[1].lowbound := 0;
|
||||
Bounds[1].elementcount := 0;
|
||||
V1 := VarArrayCreate(@Bounds, 2, varVariant);
|
||||
V2 := V1; // <- Exception EVariantBadIndexError!!!!!
|
||||
end;
|
||||
|
||||
begin
|
||||
test;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user