Browse Source

* in equal_genfunc_paradefs take care of the fact that typesym might not be assigned for open array parameters, resolves #38012

git-svn-id: trunk@47253 -
florian 4 years ago
parent
commit
1266afc0d0
3 changed files with 18 additions and 2 deletions
  1. 1 0
      .gitattributes
  2. 3 2
      compiler/defcmp.pas
  3. 14 0
      tests/webtbs/tw38012.pp

+ 1 - 0
.gitattributes

@@ -18499,6 +18499,7 @@ tests/webtbs/tw37926.pp svneol=native#text/pascal
 tests/webtbs/tw37949.pp svneol=native#text/pascal
 tests/webtbs/tw3796.pp svneol=native#text/plain
 tests/webtbs/tw37969.pp svneol=native#text/pascal
+tests/webtbs/tw38012.pp svneol=native#text/pascal
 tests/webtbs/tw3805.pp svneol=native#text/plain
 tests/webtbs/tw3814.pp svneol=native#text/plain
 tests/webtbs/tw3827.pp svneol=native#text/plain

+ 3 - 2
compiler/defcmp.pas

@@ -2622,8 +2622,9 @@ implementation
     function equal_genfunc_paradefs(fwdef,currdef:tdef;fwpdst,currpdst:tsymtable): boolean;
       begin
         result:=false;
-        if (sp_generic_para in fwdef.typesym.symoptions) and
-            (sp_generic_para in currdef.typesym.symoptions) and
+        { for open array parameters, typesym might not be assigned }
+        if assigned(fwdef.typesym) and (sp_generic_para in fwdef.typesym.symoptions) and
+           assigned(currdef.typesym) and (sp_generic_para in currdef.typesym.symoptions) and
             (fwdef.owner=fwpdst) and
             (currdef.owner=currpdst) then
           begin

+ 14 - 0
tests/webtbs/tw38012.pp

@@ -0,0 +1,14 @@
+{$mode objfpc}
+
+program test;
+
+generic procedure DoThis<T>(msg: T);
+begin
+end;
+
+generic procedure DoThis<T>(a: array of T);
+begin
+end;
+
+begin
+end.