From bb8098adea72f6b87caa27895cdbe46d870363bf Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Sat, 4 Jan 2025 11:18:00 +0100 Subject: [PATCH] + add test for already fixed #39844 --- tests/webtbs/tw39844.pp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/webtbs/tw39844.pp diff --git a/tests/webtbs/tw39844.pp b/tests/webtbs/tw39844.pp new file mode 100644 index 0000000000..b837b0c2a4 --- /dev/null +++ b/tests/webtbs/tw39844.pp @@ -0,0 +1,24 @@ +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. +