* also check for properties passed to read(ln) when reading integers

different from the native size, or when reading enums (because those
    are handled via a temp internally -> regular var parameter checks
    were not automatically performed)

git-svn-id: trunk@7398 -
This commit is contained in:
Jonas Maebe 2007-05-19 18:53:24 +00:00
parent 02a69ff049
commit 497df2bb37
3 changed files with 41 additions and 0 deletions

1
.gitattributes vendored
View File

@ -7319,6 +7319,7 @@ tests/webtbf/tw8777d.pp svneol=native#text/plain
tests/webtbf/tw8777e.pp svneol=native#text/plain
tests/webtbf/tw8777h.pp svneol=native#text/plain
tests/webtbf/tw8777j.pp svneol=native#text/plain
tests/webtbf/tw8777k.pp svneol=native#text/plain
tests/webtbf/tw8780a.pp svneol=native#text/plain
tests/webtbf/tw8780b.pp svneol=native#text/plain
tests/webtbf/tw8780c.pp svneol=native#text/plain

View File

@ -624,6 +624,12 @@ implementation
end;
if special_handling then
begin
{ since we're not going to pass the parameter as var-parameter }
{ to the read function, manually check whether the parameter }
{ can be used as var-parameter (e.g., whether it isn't a }
{ property) }
valid_for_var(para.left,true);
{ create the parameter list: the temp ... }
temp := ctempcreatenode.create(readfunctype,readfunctype.size,tt_persistent,false);
addstatement(Tstatementnode(newstatement),temp);

34
tests/webtbf/tw8777k.pp Normal file
View File

@ -0,0 +1,34 @@
{ %fail }
program BugTest;
{$mode objfpc}
type
TTest = class
private
FTest: Byte;
procedure SetTest(const Value: Byte);
public
property Test: Byte read FTest write SetTest;
end;
procedure p(var i : byte);
begin
end;
{ TTest }
procedure TTest.SetTest(const Value: Byte);
begin
Writeln('SetTest called!');
FTest := Value;
end;
var
Test: TTest;
begin
Test := TTest.Create;
Test.Test := 2;
ReadLn(Test.Test);
end.