Browse Source

* Fixed conversion from float to currency when the currency type is 64-bit integer. Issue #28748.

git-svn-id: trunk@32054 -
yury 9 years ago
parent
commit
9431648b6c
3 changed files with 17 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/ncnv.pas
  3. 14 0
      tests/webtbs/tw28748.pp

+ 1 - 0
.gitattributes

@@ -14759,6 +14759,7 @@ tests/webtbs/tw28718a.pp svneol=native#text/plain
 tests/webtbs/tw28718b.pp svneol=native#text/plain
 tests/webtbs/tw28718b.pp svneol=native#text/plain
 tests/webtbs/tw28718c.pp svneol=native#text/plain
 tests/webtbs/tw28718c.pp svneol=native#text/plain
 tests/webtbs/tw28718d.pp svneol=native#text/plain
 tests/webtbs/tw28718d.pp svneol=native#text/plain
+tests/webtbs/tw28748.pp svneol=native#text/plain
 tests/webtbs/tw2876.pp svneol=native#text/plain
 tests/webtbs/tw2876.pp svneol=native#text/plain
 tests/webtbs/tw28766.pp svneol=native#text/pascal
 tests/webtbs/tw28766.pp svneol=native#text/pascal
 tests/webtbs/tw2883.pp svneol=native#text/plain
 tests/webtbs/tw2883.pp svneol=native#text/plain

+ 2 - 0
compiler/ncnv.pas

@@ -1426,6 +1426,8 @@ implementation
         else
         else
           begin
           begin
             result:=cinlinenode.create(in_round_real,false,left);
             result:=cinlinenode.create(in_round_real,false,left);
+            { Internal type cast to currency }
+            result:=ctypeconvnode.create_internal(result,s64currencytype);
             left:=nil;
             left:=nil;
           end;
           end;
       end;
       end;

+ 14 - 0
tests/webtbs/tw28748.pp

@@ -0,0 +1,14 @@
+var
+  d: Double;
+  c, ce: Currency;
+begin
+  d := 1;
+  c := 2;
+  ce := 3;
+  c:=c + d;
+  writeln('c=', c);
+  if c <> ce then begin
+    writeln('Invalid currency value. Expected: ', ce);
+    halt(1);
+  end;
+end.