Browse Source

* only abort due to a missing overload directive if there indeed was any procdef found (due to implicit specializations there might be none), fixes compilation of tests webtbs/tw38310b and webtbs/tw38310c

Sven/Sarah Barth 3 years ago
parent
commit
b1d9d34665
1 changed files with 6 additions and 2 deletions
  1. 6 2
      compiler/htypechk.pas

+ 6 - 2
compiler/htypechk.pas

@@ -2441,6 +2441,7 @@ implementation
         srsym      : tsym;
         srsym      : tsym;
         checkstack : psymtablestackitem;
         checkstack : psymtablestackitem;
         hashedid   : THashedIDString;
         hashedid   : THashedIDString;
+        foundanything,
         hasoverload : boolean;
         hasoverload : boolean;
       begin
       begin
         { we search all overloaded operator definitions in the symtablestack. The found
         { we search all overloaded operator definitions in the symtablestack. The found
@@ -2491,8 +2492,9 @@ implementation
                   begin
                   begin
                     { add all definitions }
                     { add all definitions }
                     hasoverload:=false;
                     hasoverload:=false;
+                    foundanything:=false;
                     if tprocsym(srsym).could_be_implicitly_specialized then
                     if tprocsym(srsym).could_be_implicitly_specialized then
-                      try_implicit_specialization(srsym,FParaNode,ProcdefOverloadList,FParaAnonSyms,tsym(FProcsym),hasoverload);
+                      foundanything:=try_implicit_specialization(srsym,FParaNode,ProcdefOverloadList,FParaAnonSyms,tsym(FProcsym),hasoverload);
                     for j:=0 to tprocsym(srsym).ProcdefList.Count-1 do
                     for j:=0 to tprocsym(srsym).ProcdefList.Count-1 do
                       begin
                       begin
                         pd:=tprocdef(tprocsym(srsym).ProcdefList[j]);
                         pd:=tprocdef(tprocsym(srsym).ProcdefList[j]);
@@ -2509,10 +2511,12 @@ implementation
                         if po_overload in pd.procoptions then
                         if po_overload in pd.procoptions then
                           hasoverload:=true;
                           hasoverload:=true;
                         ProcdefOverloadList.Add(pd);
                         ProcdefOverloadList.Add(pd);
+                        foundanything:=true;
                       end;
                       end;
                     { when there is no explicit overload we stop searching,
                     { when there is no explicit overload we stop searching,
                       except for Objective-C methods called via id }
                       except for Objective-C methods called via id }
-                    if not hasoverload and
+                    if foundanything and
+                       not hasoverload and
                        not objcidcall then
                        not objcidcall then
                       break;
                       break;
                   end;
                   end;