Browse Source

* add cdo_parameter option for def_compare_ext that indicates that we
are comparing parameter lists
* openarray and normal array are not compatible anymore when comparing
parameters

git-svn-id: trunk@4754 -

peter 19 years ago
parent
commit
0ddab0c161
3 changed files with 33 additions and 4 deletions
  1. 1 0
      .gitattributes
  2. 6 4
      compiler/defcmp.pas
  3. 26 0
      tests/webtbs/tw7489.pp

+ 1 - 0
.gitattributes

@@ -7344,6 +7344,7 @@ tests/webtbs/tw7391.pp svneol=native#text/plain
 tests/webtbs/tw7425.pp svneol=native#text/plain
 tests/webtbs/tw7440.pp svneol=native#text/plain
 tests/webtbs/tw7446.pp svneol=native#text/plain
+tests/webtbs/tw7489.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 6 - 4
compiler/defcmp.pas

@@ -37,7 +37,7 @@ interface
        tcompare_paras_option = (cpo_allowdefaults,cpo_ignorehidden,cpo_allowconvert,cpo_comparedefaultvalue);
        tcompare_paras_options = set of tcompare_paras_option;
 
-       tcompare_defs_option = (cdo_internal,cdo_explicit,cdo_check_operator,cdo_allow_variant);
+       tcompare_defs_option = (cdo_internal,cdo_explicit,cdo_check_operator,cdo_allow_variant,cdo_parameter);
        tcompare_defs_options = set of tcompare_defs_option;
 
        tconverttype = (tc_none,
@@ -675,7 +675,8 @@ implementation
                                end
                             else
                              { array -> open array }
-                             if equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                             if not(cdo_parameter in cdoptions) and
+                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
                                eq:=te_equal;
                           end
                         else
@@ -708,7 +709,8 @@ implementation
                          { other arrays }
                           begin
                             { open array -> array }
-                            if is_open_array(def_from) and
+                            if not(cdo_parameter in cdoptions) and
+                               is_open_array(def_from) and
                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
                               begin
                                 eq:=te_equal
@@ -1376,7 +1378,7 @@ implementation
         i1,i2     : byte;
       begin
          compare_paras:=te_incompatible;
-         cdoptions:=[cdo_check_operator,cdo_allow_variant];
+         cdoptions:=[cdo_parameter,cdo_check_operator,cdo_allow_variant];
          { we need to parse the list from left-right so the
            not-default parameters are checked first }
          lowesteq:=high(tequaltype);

+ 26 - 0
tests/webtbs/tw7489.pp

@@ -0,0 +1,26 @@
+
+{$mode objfpc}{$H+}
+
+uses
+  Classes, SysUtils
+  { add your units here };
+
+type
+  TSingle3DVector = array[0..2] of single;
+  TSingle4DVector = array[0..3] of single;
+
+function VectorLength(const aV3D : TSingle3DVector) : single; overload;
+begin
+end;
+
+function VectorLength(const aV4D : TSingle4DVector) : single; overload;
+begin
+end;
+
+function VectorLength(const aVxD : array of single) : single; overload;
+begin
+end;
+
+
+begin
+end.