fpc/tests/webtbs/tw10320.pp
2014-03-09 17:13:40 +00:00

52 lines
829 B
ObjectPascal

program foo;
{$mode DELPHI}
type
TRgb = record
R,G,B : Byte;
end;
TRgbArray = array of TRgb;
TSomeClass = class
a: TRgbArray;
function GetP(Index : integer) : Pointer;
constructor create;
public
property P[Index: Integer]: Pointer read GetP;
end;
var a : TRgbArray;
c : TSomeClass;
constructor tsomeclass.create;
begin
setlength(a,2);
a[0].r:=1;
a[0].g:=2;
a[0].b:=3;
a[1].r:=4;
a[1].g:=5;
a[1].b:=6;
end;
function TSomeClass.GetP(Index : integer) : Pointer;
begin
result := pointer(a);
end;
begin
c := TSomeClass.Create;
a := TRgbArray(c.P[1]); // Fatal: Internal error 2006111510
if (length(a)<>2) or
(a[0].r<>1) or
(a[0].g<>2) or
(a[0].b<>3) or
(a[1].r<>4) or
(a[1].g<>5) or
(a[1].b<>6) then
halt(1);
c.free;
end.