2012/9/25 patspiper <[email protected]>:
> Hi,
>
> Despite
> http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields,
> shouldn't the following be legal? I tested under FPC 2.6.1 and 2.7.1.
This shouldn't even matter here since IMHO it should work even if Ref
were a function (and it works if Ref is a function), it should always
work as long as the expression before the ^ is a pointer type.
And interestingly this works also (as it should):
type
TMyClass = class
private
FRef: Pointer;
public
property Ref: Pointer read FRef write FRef;
end;
var
MyClass1, MyClass2: TMyClass;
procedure test;
begin
Move(MyClass1.Ref^, MyClass2.Ref^, 1);
end;
but
Move(MyClass1.Ref, MyClass2.Ref, SizeOf(TMyClass.Ref));
will give an error (as it should), no matter how its internally
represented because the code that is using this property should not be
expected to make assumptions about internal compiler optimizations, it
should always treat it like a property.
But your example should work, IMHO you have found a bug.
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal