From 2ef822e8e8545cf5335254ad8f7bcf4ae05ac77e Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Fri, 25 Oct 2024 15:18:50 +0200 Subject: [PATCH] * fix #40305: with type helpers now supporting inheriting from unique type aliases, declare a TRealHelper as a descendant of TDoubleHelper (cause Real is a Double) + added test --- rtl/objpas/sysutils/syshelph.inc | 5 +++++ tests/webtbs/tw40305.pp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/webtbs/tw40305.pp diff --git a/rtl/objpas/sysutils/syshelph.inc b/rtl/objpas/sysutils/syshelph.inc index 9f1fa2bd89..553cc98ff5 100644 --- a/rtl/objpas/sysutils/syshelph.inc +++ b/rtl/objpas/sysutils/syshelph.inc @@ -786,6 +786,11 @@ Type property Exp: QWord read GetE write SetE; property Frac: QWord read GetF write SetF; end; + +{$IFNDEF VER3_2} + TRealHelper = Type Helper(TDoubleHelper) for Real + end; +{$ENDIF} {$ENDIF FPC_HAS_TYPE_DOUBLE} {$ifdef FPC_HAS_TYPE_EXTENDED} diff --git a/tests/webtbs/tw40305.pp b/tests/webtbs/tw40305.pp new file mode 100644 index 0000000000..3cbfcf9c81 --- /dev/null +++ b/tests/webtbs/tw40305.pp @@ -0,0 +1,17 @@ +program tw40305; + +{$mode objfpc} + +uses + SysUtils; + +var + r: Real; + s: String; +begin + r := 2.42; + FormatSettings.DecimalSeparator:='.'; + s := r.ToString; + if s <> '2.42' then + Halt(1); +end.