[fpc-pascal] += property bug?

Ryan Joseph genericptr at gmail.com
Sun Aug 11 18:33:27 CEST 2019


Is this a bug? It should resolve to:

d.setter(d.getter + 10)

but it doesn’t seem to be working.

========================================

{$mode objfpc}
{$modeswitch advancedrecords}

program test;

type
  TData = record
    x: integer;
  end;

type
  TVec2Helper = record helper for TData
    function Getter: integer;
    procedure Setter(newValue: integer);
    property Get: integer read Getter write Setter;
  end;

function TVec2Helper.Getter: integer;
begin
  result := x;
end;

procedure TVec2Helper.Setter(newValue: integer);
begin
  x := newValue;
end;

var
  d: TData;
begin
  d.get += 10;	// ERROR: Variable identifier expected
end.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list