mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 13:59:28 +02:00
compiler: don't compile incorrect statements if operators are involved (issue #0015338) + test
git-svn-id: trunk@14458 -
This commit is contained in:
parent
80e2d8f221
commit
d89463588c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -9083,6 +9083,7 @@ tests/test/toperator3.pp svneol=native#text/plain
|
||||
tests/test/toperator4.pp svneol=native#text/plain
|
||||
tests/test/toperator5.pp svneol=native#text/plain
|
||||
tests/test/toperator6.pp svneol=native#text/plain
|
||||
tests/test/toperator7.pp svneol=native#text/plain
|
||||
tests/test/tover1.pp svneol=native#text/plain
|
||||
tests/test/tover2.pp svneol=native#text/plain
|
||||
tests/test/tover3.pp svneol=native#text/plain
|
||||
|
@ -1182,7 +1182,10 @@ implementation
|
||||
if not(p.nodetype in [nothingn,errorn,calln,ifn,assignn,breakn,inlinen,
|
||||
continuen,labeln,blockn,exitn]) or
|
||||
((p.nodetype=inlinen) and
|
||||
not is_void(p.resultdef)) then
|
||||
not is_void(p.resultdef)) or
|
||||
((p.nodetype=calln) and
|
||||
(assigned(tcallnode(p).procdefinition)) and
|
||||
(tcallnode(p).procdefinition.proctypeoption=potype_operator)) then
|
||||
Message(parser_e_illegal_expression);
|
||||
|
||||
{ Specify that we don't use the value returned by the call.
|
||||
|
12
tests/test/toperator7.pp
Normal file
12
tests/test/toperator7.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{%FAIL}
|
||||
program toperator7;
|
||||
{$mode objfpc}
|
||||
|
||||
uses
|
||||
Variants;
|
||||
var
|
||||
AValue: Variant;
|
||||
begin
|
||||
// this construction must fail
|
||||
AValue = 1;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user