瀏覽代碼

compiler:
- allow pointermath for pchar, pwidechar, array[] of char and array[] of widechar without pointermath directive,
- don't check tpointerdef().has_pointer_math if this is not a tpointerdef

This fixes testsuite regression (tbs/tb0439.pp)

git-svn-id: trunk@16679 -

paul 14 年之前
父節點
當前提交
906ca89f4e
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      compiler/nadd.pas

+ 6 - 2
compiler/nadd.pas

@@ -1737,7 +1737,9 @@ implementation
             if nodetype=addn then
               begin
                 if not(cs_extsyntax in current_settings.moduleswitches) or
-                   (not(is_pchar(ld)) and not(cs_pointermath in current_settings.localswitches) and not tpointerdef(ld).has_pointer_math) then
+                   (not (is_pchar(ld) or is_chararray(ld) or is_open_chararray(ld) or is_widechar(ld) or is_widechararray(ld) or is_open_widechararray(ld)) and
+                    not(cs_pointermath in current_settings.localswitches) and
+                    not((ld.typ=pointerdef) and tpointerdef(ld).has_pointer_math)) then
                   CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
                 if (rd.typ=pointerdef) and
                    (tpointerdef(rd).pointeddef.size>1) then
@@ -1768,7 +1770,9 @@ implementation
                  if (lt=niln) then
                    CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),'NIL',rd.typename);
                  if not(cs_extsyntax in current_settings.moduleswitches) or
-                    (not(is_pchar(ld)) and not(cs_pointermath in current_settings.localswitches) and not tpointerdef(ld).has_pointer_math) then
+                   (not (is_pchar(ld) or is_chararray(ld) or is_open_chararray(ld) or is_widechar(ld) or is_widechararray(ld) or is_open_widechararray(ld)) and
+                    not(cs_pointermath in current_settings.localswitches) and
+                    not((ld.typ=pointerdef) and tpointerdef(ld).has_pointer_math)) then
                    CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
                  if (ld.typ=pointerdef) then
                  begin