diff --git a/.gitattributes b/.gitattributes index 4779652538..f59a6c1bc1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13940,6 +13940,7 @@ tests/webtbs/tw25605.pp svneol=native#text/pascal tests/webtbs/tw2561.pp svneol=native#text/plain tests/webtbs/tw25610.pp -text svneol=native#text/plain tests/webtbs/tw25685.pp svneol=native#text/pascal +tests/webtbs/tw25703.pp svneol=native#text/plain tests/webtbs/tw25781.pp svneol=native#text/plain tests/webtbs/tw25814.pp svneol=native#text/plain tests/webtbs/tw25869.pp svneol=native#text/plain diff --git a/compiler/defutil.pas b/compiler/defutil.pas index 11fbfc6e32..7b7a944d49 100644 --- a/compiler/defutil.pas +++ b/compiler/defutil.pas @@ -685,10 +685,10 @@ implementation { true, if p points to an open array def } function is_open_array(p : tdef) : boolean; begin - { check for s32inttype is needed, because for u32bit the high + { check for ptrsinttype is needed, because for unsigned the high range is also -1 ! (PFV) } result:=(p.typ=arraydef) and - (tarraydef(p).rangedef=s32inttype) and + (tarraydef(p).rangedef=ptrsinttype) and (tarraydef(p).lowrange=0) and (tarraydef(p).highrange=-1) and ((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]); diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index efa918148d..e15f0d4169 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -399,7 +399,7 @@ implementation consume(_ARRAY); consume(_OF); { define range and type of range } - hdef:=carraydef.create(0,-1,s32inttype); + hdef:=carraydef.create(0,-1,ptrsinttype); { array of const ? } if (token=_CONST) and (m_objpas in current_settings.modeswitches) then begin diff --git a/tests/webtbs/tw25703.pp b/tests/webtbs/tw25703.pp new file mode 100644 index 0000000000..7f3939d41c --- /dev/null +++ b/tests/webtbs/tw25703.pp @@ -0,0 +1,18 @@ +{ %norun } +{ %opt=-CO -Seh } + +{$MODE OBJFPC} +type + TNode = class end; + +procedure Test(const Arg: array of TNode); +var + Item: TNode; +begin + for Item in Arg do ; // Warning here +end; + +begin + test([]); +end. +