Răsfoiți Sursa

* handle currency constants correctly on non i386 platforms if they are given as integer constant, resolves #21091

git-svn-id: trunk@20734 -
florian 13 ani în urmă
părinte
comite
7fe6c0d95d
3 a modificat fișierele cu 12 adăugiri și 1 ștergeri
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/ptconst.pas
  3. 10 0
      tests/webtbs/tw21091.pp

+ 1 - 0
.gitattributes

@@ -12294,6 +12294,7 @@ tests/webtbs/tw21029.pp svneol=native#text/plain
 tests/webtbs/tw21044.pp svneol=native#text/pascal
 tests/webtbs/tw21073.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
+tests/webtbs/tw21091.pp svneol=native#text/pascal
 tests/webtbs/tw2110.pp svneol=native#text/plain
 tests/webtbs/tw21146.pp svneol=native#text/pascal
 tests/webtbs/tw21151.pp svneol=native#text/plain

+ 1 - 1
compiler/ptconst.pas

@@ -261,7 +261,7 @@ implementation
               scurrency:
                 begin
                    if is_constintnode(n) then
-                     intvalue := tordconstnode(n).value
+                     intvalue:=tordconstnode(n).value*10000
                    { allow bootstrapping }
                    else if is_constrealnode(n) then
                      intvalue:=PInt64(@trealconstnode(n).value_currency)^

+ 10 - 0
tests/webtbs/tw21091.pp

@@ -0,0 +1,10 @@
+CONST C : Currency = 100;
+var
+  s : string;
+
+begin
+  str(C:10:2,s);
+  if s<>'    100.00' then
+    halt(1);
+  writeln('ok');
+end.