diff --git a/.gitattributes b/.gitattributes index fa9c0f9102..334e63362a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8295,6 +8295,7 @@ tests/webtbs/tw8950.pp svneol=native#text/plain tests/webtbs/tw8975.pp svneol=native#text/plain tests/webtbs/tw8975a.pp svneol=native#text/plain tests/webtbs/tw9054.pp svneol=native#text/plain +tests/webtbs/tw9085.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/defcmp.pas b/compiler/defcmp.pas index d2813183aa..0adff612d1 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -848,7 +848,11 @@ implementation begin { string constant (which can be part of array constructor) to zero terminated string constant } - if (fromtreetype in [arrayconstructorn,stringconstn]) and + if (((fromtreetype = arrayconstructorn) and + { can't use is_chararray, because returns false for } + { array constructors } + is_char(tarraydef(def_from).elementdef)) or + (fromtreetype = stringconstn)) and (is_pchar(def_to) or is_pwidechar(def_to)) then begin doconv:=tc_cstring_2_pchar; @@ -937,7 +941,11 @@ implementation begin { string constant (which can be part of array constructor) to zero terminated string constant } - if (fromtreetype in [arrayconstructorn,stringconstn]) and + if (((fromtreetype = arrayconstructorn) and + { can't use is_chararray, because returns false for } + { array constructors } + is_char(tarraydef(def_from).elementdef)) or + (fromtreetype = stringconstn)) and (is_pchar(def_to) or is_pwidechar(def_to)) then begin doconv:=tc_cstring_2_pchar; diff --git a/tests/webtbs/tw9085.pp b/tests/webtbs/tw9085.pp new file mode 100644 index 0000000000..2af3dcb281 --- /dev/null +++ b/tests/webtbs/tw9085.pp @@ -0,0 +1,25 @@ +program chatserver; + +{$mode objfpc} + +procedure Sendln(MsgType: Longint; Str: PChar); +begin + halt(1); +end; + +procedure Sendln(MsgType: Longint; Str: array of PChar); +begin + halt(0); +end; + + +procedure Sendln(MsgType: Longint; Str: array of char); +begin + halt(1); +end; + + + +begin + Sendln(1, ['str1', 'str2']) +end.