fpc/tests/webtbs/tw39844.pp
2025-01-04 11:19:20 +01:00

25 lines
401 B
ObjectPascal

program tw39844;
{$mode objfpc} {$typedaddress on} {$modeswitch typehelpers} {$coperators on}
type
XType = double;
XTypeHelper = type helper for XType
procedure Add(x: XType); inline;
end;
procedure XTypeHelper.Add(x: XType);
begin
self += x;
end;
var
x: XType;
begin
x := 0;
(@x)^.Add(1);
if x <> 1 then begin writeln('x = ', x, ', expected 1'); halt(1); end;
writeln('ok');
end.