* disallow using inline nodes with a non-void resultdef as statements

(e.g. length, lo/hi, ord, etc). Not the same as mantis #9918, but
    somewhat related

git-svn-id: trunk@8770 -
This commit is contained in:
Jonas Maebe 2007-10-12 11:54:37 +00:00
parent 775ee6f563
commit c89ea4412f
6 changed files with 43 additions and 1 deletions

4
.gitattributes vendored
View File

@ -7496,6 +7496,10 @@ tests/webtbf/tw9522e.pp svneol=native#text/plain
tests/webtbf/tw9579a.pp svneol=native#text/plain
tests/webtbf/tw9579b.pp svneol=native#text/plain
tests/webtbf/tw9894b.pp svneol=native#text/plain
tests/webtbf/tw9918a.pp svneol=native#text/plain
tests/webtbf/tw9918b.pp svneol=native#text/plain
tests/webtbf/tw9918c.pp svneol=native#text/plain
tests/webtbf/tw9918d.pp svneol=native#text/plain
tests/webtbf/uw0744.pp svneol=native#text/plain
tests/webtbf/uw0840a.pp svneol=native#text/plain
tests/webtbf/uw0840b.pp svneol=native#text/plain

View File

@ -1074,7 +1074,9 @@ implementation
{ with a separate statement for each read/write operation (JM) }
{ the same is true for val() if the third parameter is not 32 bit }
if not(p.nodetype in [nothingn,calln,ifn,assignn,breakn,inlinen,
continuen,labeln,blockn,exitn]) then
continuen,labeln,blockn,exitn]) or
((p.nodetype=inlinen) and
not is_void(p.resultdef)) then
Message(parser_e_illegal_expression);
{ Specify that we don't use the value returned by the call.

9
tests/webtbf/tw9918a.pp Normal file
View File

@ -0,0 +1,9 @@
{ %fail }
{$x-}
var
a: array of byte;
begin
length(a);
end.

9
tests/webtbf/tw9918b.pp Normal file
View File

@ -0,0 +1,9 @@
{ %fail }
{$x+}
var
s: shortstring;
begin
length(s);
end.

9
tests/webtbf/tw9918c.pp Normal file
View File

@ -0,0 +1,9 @@
{ %fail }
{$x+}
var
l: longint;
begin
lo(l);
end.

9
tests/webtbf/tw9918d.pp Normal file
View File

@ -0,0 +1,9 @@
{ %fail }
{$x+}
var
d: double;
begin
trunc(d);
end.