mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 05:29:34 +02:00
* fix for Mantis #38390: use Val instead of StrToInt to avoid overload problems
+ added test git-svn-id: trunk@48399 -
This commit is contained in:
parent
268f7bfb5c
commit
c3fd06b6b5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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;
|
||||
|
23
tests/webtbs/tw38390.pp
Normal file
23
tests/webtbs/tw38390.pp
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user