Skip to content

property with "index const" gives wrong value #12

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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