Skip to content

property with "index const" gives wrong value #12

@User4martin

Description

@User4martin
(pdr) p x
X = TFoo(@$00007F507D368060) { Bar: <getter: GetBar> }
(pdr) inspect x
[INSPECT] x: TFoo (class, 8 bytes)
[INSPECT] parent chain: TFoo -> TObject
[INSPECT] properties (1):
Bar = <getter: GetBar>     [use 'print x.Bar' to evaluate]
(pdr) p x.Bar
x.Bar = -1186891932

X.Bar should be 102

program project1;
{$Mode objfpc}
type
  TFoo = class
  private
    function GetBar(AIndex: Integer): integer;
  published
    property Bar: integer index 2 read GetBar;
  end;

function TFoo.GetBar(AIndex: Integer): integer;
begin
  Result := AIndex + 100;
end;

var x: TFoo;
begin
  x := TFoo.Create;
writeln();
end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions