fpc doesn't compile address operator in particular access order with function and object access
Original Reporter info from Mantis: Maxerist
-
Reporter name: Max Vlasov
Original Reporter info from Mantis: Maxerist
- Reporter name: Max Vlasov
Description:
The following fragment doesn't compile with {$mode delphi}
type
TObj = class
private
fArr: PByteArray;
public
property Arr: PByteArray read fArr;
end;
function ReturnObj(): TObj;
begin
Result:=Nil;
end;
procedure TestAccess;
var
B: pointer;
begin
B:=@ReturnObj().Arr[10];
end;
The compiler says
Fatal: Syntax error, ";" expected but "(" found
for the line
B:=@ReturnObj().Arr[10];
while Delphi (5) compiles the fragment
Steps to reproduce:
Paste the fragment above to any unit's implementation section and try to compile
Additional information:
This is a generalized fragment, there was actual used in my project previously used in Delphi that makes more sense
Mantis conversion info:
- Mantis ID: 19861
- Version: 2.5.1
- Fixed in revision: 35495 (#16a11c8b)