* fixed addr(procedure), mantis #28775

git-svn-id: trunk@32204 -
This commit is contained in:
nickysn 2015-10-30 15:17:48 +00:00
parent 79866f9824
commit c25585daee
3 changed files with 35 additions and 2 deletions

1
.gitattributes vendored
View File

@ -11149,6 +11149,7 @@ tests/test/cg/taddint.pp svneol=native#text/plain
tests/test/cg/taddlong.pp svneol=native#text/plain
tests/test/cg/taddr1.pp svneol=native#text/plain
tests/test/cg/taddr2.pp svneol=native#text/plain
tests/test/cg/taddr3.pp svneol=native#text/plain
tests/test/cg/taddreal1.pp svneol=native#text/plain
tests/test/cg/taddreal2.pp svneol=native#text/plain
tests/test/cg/taddreal3.pp svneol=native#text/plain

View File

@ -583,9 +583,13 @@ implementation
in_addr_x :
begin
consume(_LKLAMMER);
in_args:=true;
p1:=comp_expr(true,false);
got_addrn:=true;
p1:=factor(true,false,false);
{ inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
if token<>_RKLAMMER then
p1:=sub_expr(opcompare,true,false,p1);
p1:=caddrnode.create(p1);
got_addrn:=false;
consume(_RKLAMMER);
statement_syssym:=p1;
end;

28
tests/test/cg/taddr3.pp Normal file
View File

@ -0,0 +1,28 @@
program taddr3;
{$ifndef FPC}
type
codepointer = pointer;
{$endif}
procedure testproc;
begin
end;
function testfunc: codepointer;
begin
testfunc:=nil;
end;
var
p1, p2: codepointer;
begin
p1 := @testproc;
p2 := Addr(testproc);
if p1<>p2 then
Halt(1);
p1 := @testfunc;
p2 := Addr(testfunc);
if p1<>p2 then
Halt(2);
end.