* 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
This commit is contained in:
Sven/Sarah Barth 2024-10-25 15:18:50 +02:00
parent 4ef30edbd4
commit 2ef822e8e8
2 changed files with 22 additions and 0 deletions

View File

@ -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}

17
tests/webtbs/tw40305.pp Normal file
View File

@ -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.