diff --git a/.gitattributes b/.gitattributes index d40a9f7762..6ca554d47b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 005a87056a..92227d97f4 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -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 diff --git a/tests/webtbs/tw6960.pp b/tests/webtbs/tw6960.pp new file mode 100644 index 0000000000..4000c7db15 --- /dev/null +++ b/tests/webtbs/tw6960.pp @@ -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. +