瀏覽代碼

* allow equal result types instead of exactly the same result types for generic functions if both are specializations (otherwise they would be considered as different if they depend on the generic function's generic types)

git-svn-id: trunk@34409 -
svenbarth 9 年之前
父節點
當前提交
a4a1e9db12
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      compiler/pdecsub.pas

+ 8 - 2
compiler/pdecsub.pas

@@ -3434,8 +3434,14 @@ const
           if compare_paras(fwpd.paras,currpd.paras,cp_none,[cpo_ignorehidden,cpo_openequalisexact,cpo_ignoreuniv,cpo_generic])<>te_exact then
           if compare_paras(fwpd.paras,currpd.paras,cp_none,[cpo_ignorehidden,cpo_openequalisexact,cpo_ignoreuniv,cpo_generic])<>te_exact then
             exit;
             exit;
           if not foundretdef then
           if not foundretdef then
-            { the returndef isn't a type parameter, so compare as usual }
-            result:=compare_defs(fwpd.returndef,currpd.returndef,nothingn)=te_exact
+            begin
+              if tstoreddef(fwpd.returndef).is_specialization and tstoreddef(currpd.returndef).is_specialization then
+                { for specializations we're happy with equal defs instead of exactly the same defs }
+                result:=equal_defs(fwpd.returndef,currpd.returndef)
+              else
+                { the returndef isn't a type parameter, so compare as usual }
+                result:=compare_defs(fwpd.returndef,currpd.returndef,nothingn)=te_exact;
+            end
           else
           else
             result:=true;
             result:=true;
         end;
         end;