Browse Source

* fixed web bug #4647 (untyped elements in array constructors) + test

git-svn-id: trunk@2110 -
Jonas Maebe 19 years ago
parent
commit
6d3ae16267
3 changed files with 20 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/nld.pas
  3. 16 0
      tests/webtbf/tw4647.pp

+ 1 - 0
.gitattributes

@@ -5941,6 +5941,7 @@ tests/webtbf/tw4569a.pp svneol=native#text/plain
 tests/webtbf/tw4569b.pp svneol=native#text/plain
 tests/webtbf/tw4619a.pp -text svneol=unset#text/plain
 tests/webtbf/tw4619b.pp svneol=native#text/plain
+tests/webtbf/tw4647.pp svneol=native#text/plain
 tests/webtbf/tw4651.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain

+ 3 - 1
compiler/nld.pas

@@ -970,7 +970,9 @@ implementation
                      begin
                        if is_integer(hp.left.resulttype.def) and
                           not(is_64bitint(hp.left.resulttype.def)) then
-                         hp.left:=ctypeconvnode.create(hp.left,s32inttype);
+                         hp.left:=ctypeconvnode.create(hp.left,s32inttype)
+                       else if is_void(hp.left.resulttype.def) then
+                         CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
                      end;
                    floatdef :
                      if not(is_currency(hp.left.resulttype.def)) then

+ 16 - 0
tests/webtbf/tw4647.pp

@@ -0,0 +1,16 @@
+{ %fail }
+
+{$mode delphi}
+program test;
+
+uses
+  SysUtils;
+
+procedure shiny;
+begin
+end;
+
+begin
+  Format('%s', [shiny()]);
+end.
+