summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw10979.pp
blob: 68d7127c6d579a43ad578dc38501bd4d9a333b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{$ifdef fpc}
{$mode objfpc}
{$endif fpc}

uses Classes;

{$ifndef fpc}
type
  ptruint = cardinal;
{$endif}

type
  TMyStringList = class(TStringList)
  private
    function GetObjects(Index: Integer): TStringList;
    procedure SetObjects(Index: Integer; const Value: TStringList);  
  public
    property Objects[Index: Integer]: TStringList read GetObjects write SetObjects;
  end;

function TMyStringList.GetObjects(Index: Integer): TStringList;
begin
  Result := TStringList(inherited Objects[Index]);
end;

procedure TMyStringList.SetObjects(Index: Integer; const Value: TStringList);
begin
  writeln('setobjects called');
  inherited Objects[Index] := Value;
end;

              
var
  SL: TMyStringList;
begin
  SL := TMyStringList.Create;
  SL.AddObject('Hello',SL);
  WriteLn(SL[0],':',PtrUint(SL.Objects[0]),':',PtrUint(SL));
  if (sl[0]<>'Hello') or
     (PtrUint(SL.Objects[0])<>PtrUint(SL)) then
    halt(1);
end.