浏览代码

* allow implicit conversions from/to packed char arrays under the
same conditions as from/two regular char arrays (since a packed
char array is the same as a string in ISO Pascal)

git-svn-id: trunk@4468 -

Jonas Maebe 19 年之前
父节点
当前提交
47eb589d54
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11 3
      compiler/defcmp.pas

+ 11 - 3
compiler/defcmp.pas

@@ -601,9 +601,17 @@ implementation
                   case def_from.deftype of
                   case def_from.deftype of
                     arraydef :
                     arraydef :
                       begin
                       begin
-                        { from/to packed array }
-                        if is_packed_array(def_from) xor
-                           is_packed_array(def_to) then
+                        { from/to packed array -- packed chararrays are      }
+                        { strings in ISO Pascal (at least if the lower bound }
+                        { is 1, but GPC makes all equal-length chararrays    }
+                        { compatible), so treat those the same as regular    }
+                        { char arrays                                        }
+                        if (is_packed_array(def_from) and
+                            not is_chararray(def_from) and
+                            not is_widechararray(def_from)) xor
+                           (is_packed_array(def_to) and
+                            not is_chararray(def_to) and
+                            not is_widechararray(def_to)) then
                           { both must be packed }
                           { both must be packed }
                           begin
                           begin
                             compare_defs_ext:=te_incompatible;
                             compare_defs_ext:=te_incompatible;