* nested open array constructors are not allowed, resolves #17213

git-svn-id: trunk@15876 -
This commit is contained in:
florian 2010-08-22 20:13:27 +00:00
parent 14247ef2db
commit 700f687692
3 changed files with 22 additions and 0 deletions

1
.gitattributes vendored
View File

@ -10629,6 +10629,7 @@ tests/webtbs/tw17164.pp svneol=native#text/plain
tests/webtbs/tw17180.pp svneol=native#text/plain
tests/webtbs/tw17181.pp svneol=native#text/plain
tests/webtbs/tw1720.pp svneol=native#text/plain
tests/webtbs/tw17213.pp svneol=native#text/pascal
tests/webtbs/tw1735.pp svneol=native#text/plain
tests/webtbs/tw1737.pp svneol=native#text/plain
tests/webtbs/tw1744.pp svneol=native#text/plain

View File

@ -1712,6 +1712,7 @@ implementation
p1,p2 : tnode;
lastp,
buildp : tarrayconstructornode;
old_allow_array_constructor : boolean;
begin
buildp:=nil;
{ be sure that a least one arrayconstructn is used, also for an
@ -1720,6 +1721,9 @@ implementation
buildp:=carrayconstructornode.create(nil,buildp)
else
repeat
{ nested array constructors are not allowed, see also tests/webtbs/tw17213.pp }
old_allow_array_constructor:=allow_array_constructor;
allow_array_constructor:=false;
p1:=comp_expr(true);
if try_to_consume(_POINTPOINT) then
begin
@ -1737,6 +1741,7 @@ implementation
lastp.right:=carrayconstructornode.create(p1,nil);
lastp:=tarrayconstructornode(lastp.right);
end;
allow_array_constructor:=old_allow_array_constructor;
{ there could be more elements }
until not try_to_consume(_COMMA);
factor_read_set:=buildp;

16
tests/webtbs/tw17213.pp Normal file
View File

@ -0,0 +1,16 @@
program openarrayparam;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
{$ifdef mswindows}{$apptype console}{$endif}
uses
sysutils;
type
testflagty = (tf_1,tf2);
testflagsty = set of testflagty;
procedure testproc(const testpar: array of testflagsty);
begin
end;
begin
testproc([[],[],[]]);
end.