Browse Source

Merged revisions 2110 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

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

git-svn-id: branches/fixes_2_0@2111 -

Jonas Maebe 20 years ago
parent
commit
13efc74c12
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

@@ -5631,6 +5631,7 @@ tests/webtbf/tw4256.pp svneol=native#text/plain
 tests/webtbf/tw4359.pp svneol=native#text/plain
 tests/webtbf/tw4445.pp svneol=native#text/plain
 tests/webtbf/tw4529.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

@@ -982,7 +982,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.
+