Browse Source

* don't give an internalerror when trying to explicitly apply an invalid
typecast to an array-of-const (mantis #18267)

git-svn-id: trunk@16749 -

Jonas Maebe 14 years ago
parent
commit
d76ddcabe6
3 changed files with 17 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/ncnv.pas
  3. 15 0
      tests/webtbf/tw18267.pp

+ 1 - 0
.gitattributes

@@ -10138,6 +10138,7 @@ tests/webtbf/tw17646a.pp svneol=native#text/plain
 tests/webtbf/tw1782.pp svneol=native#text/plain
 tests/webtbf/tw18096.pp svneol=native#text/pascal
 tests/webtbf/tw18096c.pp svneol=native#text/pascal
+tests/webtbf/tw18267.pp svneol=native#text/plain
 tests/webtbf/tw1827.pp svneol=native#text/plain
 tests/webtbf/tw1830.pp svneol=native#text/plain
 tests/webtbf/tw1842.pp svneol=native#text/plain

+ 1 - 0
compiler/ncnv.pas

@@ -1962,6 +1962,7 @@ implementation
                                 (
                                  not(is_open_array(left.resultdef)) and
                                  not(is_array_constructor(left.resultdef)) and
+                                 not(is_array_of_const(left.resultdef)) and
                                  (left.resultdef.size=resultdef.size) and
                                  { disallow casts of const nodes }
                                  (not is_constnode(left) or

+ 15 - 0
tests/webtbf/tw18267.pp

@@ -0,0 +1,15 @@
+{ %fail }
+
+program typecasttest;
+
+{$mode objfpc}
+
+procedure Test(const aArgs: array of const);
+begin
+  TVarRec(aArgs);
+end;
+
+begin
+
+end.
+