diff --git a/.gitattributes b/.gitattributes index af9cc586b0..b466c1a519 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18644,6 +18644,7 @@ tests/webtbs/tw3833.pp svneol=native#text/plain tests/webtbs/tw38337.pp svneol=native#text/plain tests/webtbs/tw38339.pp svneol=native#text/plain tests/webtbs/tw38351.pp -text svneol=native#text/pascal +tests/webtbs/tw38390.pp svneol=native#text/pascal tests/webtbs/tw3840.pp svneol=native#text/plain tests/webtbs/tw3841.pp svneol=native#text/plain tests/webtbs/tw3863.pp svneol=native#text/plain diff --git a/rtl/objpas/sysutils/syshelpo.inc b/rtl/objpas/sysutils/syshelpo.inc index 0ab24ea753..2f6efc6994 100644 --- a/rtl/objpas/sysutils/syshelpo.inc +++ b/rtl/objpas/sysutils/syshelpo.inc @@ -1,8 +1,12 @@ Class Function TORDINALHELPER.Parse(const AString: string): TORDINALTYPE; inline; static; +var + Error: Integer; begin - Result:=StrToInt(AString); + Val(AString,Result,Error); + if Error<>0 then + raise EConvertError.CreateFmt(SInvalidInteger,[AString]); end; Class Function TORDINALHELPER.Size: Integer; inline; static; diff --git a/tests/webtbs/tw38390.pp b/tests/webtbs/tw38390.pp new file mode 100644 index 0000000000..11a2c523b0 --- /dev/null +++ b/tests/webtbs/tw38390.pp @@ -0,0 +1,23 @@ +program tw38390; +{$MODE Delphi} +uses SysUtils; + +var + s: String; + x: UInt64; + +begin + s := '20000000000'; + x := UInt64.Parse(s); + WriteLn(x); + if x <> 20000000000 then + Halt(1); + UInt64.TryParse(s, x); + WriteLn(x); + if x <> 20000000000 then + Halt(2); + x := StrToQWord(s); + WriteLn(x); + if x <> 20000000000 then + Halt(3); +end.