浏览代码

* don't give -CO warnings or hints for ordinal constants, because those
are already checked by range checking (and were checked wrongly by -CO
checking) (mantis #19581)

git-svn-id: trunk@21504 -

Jonas Maebe 13 年之前
父节点
当前提交
12553a9367
共有 3 个文件被更改,包括 17 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/htypechk.pas
  3. 13 0
      tests/webtbs/tw19581.pp

+ 1 - 0
.gitattributes

@@ -12503,6 +12503,7 @@ tests/webtbs/tw19500.pp svneol=native#text/pascal
 tests/webtbs/tw19511.pp svneol=native#text/pascal
 tests/webtbs/tw19548.pp svneol=native#text/pascal
 tests/webtbs/tw19555.pp svneol=native#text/pascal
+tests/webtbs/tw19581.pp svneol=native#text/plain
 tests/webtbs/tw19622.pp -text svneol=native#text/plain
 tests/webtbs/tw1964.pp svneol=native#text/plain
 tests/webtbs/tw19651.pp svneol=native#text/plain

+ 3 - 1
compiler/htypechk.pas

@@ -3083,7 +3083,9 @@ implementation
           assigned(source.resultdef) and
           (source.resultdef.typ in [enumdef,orddef,floatdef]) and
           not is_boolean(source.resultdef) and
-          not is_constrealnode(source) then
+          not is_constrealnode(source) and
+          { constants are handled via regular range checking }
+          (source.nodetype<>ordconstn) then
          begin
            if ((destdef.size < source.resultdef.size) and
                { s80real and sc80real have a different size but the same precision }

+ 13 - 0
tests/webtbs/tw19581.pp

@@ -0,0 +1,13 @@
+{ %opt=-CO -vh -Seh }
+{ %norun }
+program tw19581;
+
+type
+   TFoo = 0..1000;
+var
+   Foo: TFoo;
+begin
+   Foo:=999;
+   writeln(Foo);
+end.
+