Browse Source

* don't give range check hints/warnings for conversions of
realconstnodes to types with less precision than the default (bug 4898)

git-svn-id: trunk@2957 -

Jonas Maebe 19 years ago
parent
commit
9dbd69c307
3 changed files with 15 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/htypechk.pas
  3. 12 0
      tests/webtbs/tw4898.pp

+ 1 - 0
.gitattributes

@@ -6752,6 +6752,7 @@ tests/webtbs/tw4768.pp -text
 tests/webtbs/tw4778.pp svneol=native#text/plain
 tests/webtbs/tw4778.pp svneol=native#text/plain
 tests/webtbs/tw4789.pp svneol=native#text/plain
 tests/webtbs/tw4789.pp svneol=native#text/plain
 tests/webtbs/tw4809.pp svneol=native#text/plain
 tests/webtbs/tw4809.pp svneol=native#text/plain
+tests/webtbs/tw4898.pp -text
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 2 - 1
compiler/htypechk.pas

@@ -2228,7 +2228,8 @@ implementation
           not is_boolean(destdef) and
           not is_boolean(destdef) and
           assigned(source.resulttype.def) and
           assigned(source.resulttype.def) and
           (source.resulttype.def.deftype in [enumdef,orddef,floatdef]) and
           (source.resulttype.def.deftype in [enumdef,orddef,floatdef]) and
-          not is_boolean(source.resulttype.def) then
+          not is_boolean(source.resulttype.def) and
+          not is_constrealnode(source) then
          begin
          begin
            if (destdef.size < source.resulttype.def.size) then
            if (destdef.size < source.resulttype.def.size) then
              begin
              begin

+ 12 - 0
tests/webtbs/tw4898.pp

@@ -0,0 +1,12 @@
+{ %OPT=-Sewh -vwh}
+
+{ Source provided for Free Pascal Bug Report 4898 }
+{ Submitted by "Naj Kejah" on  2006-03-13 }
+{ e-mail: [email protected] }
+program aFP211p; 
+var R : real;
+begin
+  R:=0.0;
+  writeln(r);
+end.
+