Browse Source

* tassignmentnode.pass_typecheck: also allow "dynarray := []" in addition to "dynarray := nil"

git-svn-id: trunk@36098 -
svenbarth 8 years ago
parent
commit
dfc23da06c
1 changed files with 9 additions and 2 deletions
  1. 9 2
      compiler/nld.pas

+ 9 - 2
compiler/nld.pas

@@ -626,9 +626,16 @@ implementation
               converted node (that array is 2^31 or 2^63 bytes large) }
             exit;
 
-        { assigning nil to a dynamic array clears the array }
+        { assigning nil or [] to a dynamic array clears the array }
         if is_dynamic_array(left.resultdef) and
-           (right.nodetype=niln) then
+            (
+              (right.nodetype=niln) or
+              (
+                (right.nodetype=arrayconstructorn) and
+                (right.resultdef.typ=arraydef) and
+                (tarraydef(right.resultdef).elementdef=voidtype)
+              )
+            ) then
          begin
            { remove property flag to avoid errors, see comments for }
            { tf_winlikewidestring assignments below                 }