瀏覽代碼

* Consider conversion from integer to integer te_equal, if the base types
are equal and the range of the from type fits in the to type. I.e.
conversion from -10..10 to shortint is considered equal. This is correct
because in this case, the from type can be used wherever the to type is
used, i.e. the compiler never needs to do conversion at compile or run
time.

git-svn-id: trunk@7814 -

daniel 18 年之前
父節點
當前提交
504d845e86
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      compiler/defcmp.pas

+ 2 - 2
compiler/defcmp.pas

@@ -225,8 +225,8 @@ implementation
                           u8bit,u16bit,u32bit,u64bit,
                           s8bit,s16bit,s32bit,s64bit:
                             begin
-                              if (torddef(def_from).low=torddef(def_to).low) and
-                                 (torddef(def_from).high=torddef(def_to).high) then
+                              if (torddef(def_from).low>=torddef(def_to).low) and
+                                 (torddef(def_from).high<=torddef(def_to).high) then
                                 eq:=te_equal
                               else
                                 begin