Răsfoiți Sursa

* initialise mineq before exiting the parameter checking loop for open array
parameters (bug in r28862, mantis #26976)

git-svn-id: trunk@28954 -

Jonas Maebe 10 ani în urmă
părinte
comite
dc4a2a59f7
3 a modificat fișierele cu 20 adăugiri și 2 ștergeri
  1. 1 0
      .gitattributes
  2. 2 2
      compiler/htypechk.pas
  3. 17 0
      tests/webtbs/tw26976.pp

+ 1 - 0
.gitattributes

@@ -14109,6 +14109,7 @@ tests/webtbs/tw2678.pp svneol=native#text/plain
 tests/webtbs/tw2690.pp svneol=native#text/plain
 tests/webtbs/tw2690.pp svneol=native#text/plain
 tests/webtbs/tw2691.pp svneol=native#text/plain
 tests/webtbs/tw2691.pp svneol=native#text/plain
 tests/webtbs/tw2696.pp svneol=native#text/plain
 tests/webtbs/tw2696.pp svneol=native#text/plain
+tests/webtbs/tw26976.pp svneol=native#text/plain
 tests/webtbs/tw2702.pp svneol=native#text/plain
 tests/webtbs/tw2702.pp svneol=native#text/plain
 tests/webtbs/tw2703.pp svneol=native#text/plain
 tests/webtbs/tw2703.pp svneol=native#text/plain
 tests/webtbs/tw2704.pp svneol=native#text/plain
 tests/webtbs/tw2704.pp svneol=native#text/plain

+ 2 - 2
compiler/htypechk.pas

@@ -2780,10 +2780,10 @@ implementation
                       eq:=te_incompatible
                       eq:=te_incompatible
                     else
                     else
                       eq:=compare_defs_ext(tarrayconstructornode(n).left.resultdef,tarraydef(def_to).elementdef,tarrayconstructornode(n).left.nodetype,convtype,pdoper,cdoptions);
                       eq:=compare_defs_ext(tarrayconstructornode(n).left.resultdef,tarraydef(def_to).elementdef,tarrayconstructornode(n).left.nodetype,convtype,pdoper,cdoptions);
-                    if eq=te_incompatible then
-                      break;
                     if eq<mineq then
                     if eq<mineq then
                       mineq:=eq;
                       mineq:=eq;
+                    if eq=te_incompatible then
+                      break;
                     n:=tarrayconstructornode(n).right;
                     n:=tarrayconstructornode(n).right;
                   until not assigned(n);
                   until not assigned(n);
                   eq:=mineq;
                   eq:=mineq;

+ 17 - 0
tests/webtbs/tw26976.pp

@@ -0,0 +1,17 @@
+{ %norun }
+
+{$MODE OBJFPC}
+program test;
+
+type
+   TTest = class end;
+
+procedure E(Arg1: array of UTF8String);
+begin end;
+
+procedure E(Arg1: array of TTest);
+begin end;
+
+begin
+   E(['aa']); // Incompatible types: got "Constant String" expected "TTest"
+end.