Can't take the address of constant expressions bug
Original Reporter info from Mantis: Stephano
-
Reporter name:
Original Reporter info from Mantis: Stephano
- Reporter name:
Description:
Despite http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields, the following should be legal (tested under FPC 2.6.1 and 2.7.1).
TMyRecord = record
Data: pointer;
end;
TMyClass = class
private
FRef: TMyRecord;
public
property Ref: TMyRecord read FRef write FRef;
end;
var
MyClass1, MyClass2: TMyClass;
procedure test;
begin
Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1);
end;
Casting to PByte circumvents the error:
Move(MyClass1.Ref.Data^, PByte(MyClass2.Ref.Data)^, 1);
The complete program is attached.
Mantis conversion info:
- Mantis ID: 22979
- Version: 2.6.1
- Fixed in version: 3.1.1
- Fixed in revision: 35308 (#382bbc12)
- Monitored by: » Nitorami (Nitorami), » Vincent (Vincent Snijders)