2
0
Эх сурвалжийг харах

First attempt to fix bug report #40537

Pierre Muller 1 жил өмнө
parent
commit
f39cfc75fc
1 өөрчлөгдсөн 7 нэмэгдсэн , 1 устгасан
  1. 7 1
      compiler/htypechk.pas

+ 7 - 1
compiler/htypechk.pas

@@ -3035,6 +3035,11 @@ implementation
                  not is_array_of_const(def_from) and
                  not is_array_constructor(def_from) then
                 eq:=te_equal
+              else
+                { if var or out parameter type but paranode not is_valid_for_var }
+                if (currpara.varspez in [vs_var,vs_out]) and not valid_for_var(currpt.left,false)
+                   and (currpara.vardef.typ<>formaldef) then
+                  eq:=te_incompatible
               else
               { same definition -> exact }
                if (def_from=def_to) then
@@ -3170,7 +3175,8 @@ implementation
                         eq:=te_incompatible;
                         { var_para_allowed will return te_equal and te_convert_l1 to
                           make a difference for best matching }
-                        var_para_allowed(eq,currpt.resultdef,currpara.vardef,currpt.left)
+			if valid_for_var(currpt.left,false) or (currpara.vardef.typ=formaldef) then
+                          var_para_allowed(eq,currpt.resultdef,currpara.vardef,currpt.left)
                       end
                     else
                       para_allowed(eq,currpt,def_to);