* allow passing single element to open array bug6960

git-svn-id: trunk@3634 -
This commit is contained in:
peter 2006-05-23 07:23:45 +00:00
parent 2ddd617971
commit 5e5edcb520
3 changed files with 24 additions and 4 deletions

1
.gitattributes vendored
View File

@ -6828,6 +6828,7 @@ tests/webtbs/tw6684.pp svneol=native#text/plain
tests/webtbs/tw6735.pp svneol=native#text/plain
tests/webtbs/tw6742.pp svneol=native#text/plain
tests/webtbs/tw6767.pp svneol=native#text/plain
tests/webtbs/tw6960.pp svneol=native#text/plain
tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain
tests/webtbs/uw0555.pp svneol=native#text/plain

View File

@ -1336,10 +1336,15 @@ implementation
end;
arraydef :
begin
if is_open_array(def_to) and
is_dynamic_array(def_from) and
equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
eq:=te_convert_l2;
if is_open_array(def_to) then
begin
if is_dynamic_array(def_from) and
equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
eq:=te_convert_l2
else
if equal_defs(def_from,tarraydef(def_to).elementtype.def) then
eq:=te_convert_l2;
end;
end;
pointerdef :
begin

14
tests/webtbs/tw6960.pp Normal file
View File

@ -0,0 +1,14 @@
function SomeFunc(var Res: array of Double): Integer;
begin
// do something
writeln(High(Res));
end;
var
d: Double;
darr: array[1..3] of Double;
begin
SomeFunc(d); // Delphi accepts this, FPC does not
SomeFunc(darr); // OK
end.