浏览代码

Remaining fix for Mantis #28674.

ptype.pas, resolve_forward_types:
  * in case of the def of the forward being the same as the genericdef of the def the forwarddef belongs to the typesym needs to be changed to the one of the specialization

tests/webtbs/tw28674.pp:
  * adjusted text

git-svn-id: trunk@31987 -
svenbarth 10 年之前
父节点
当前提交
d4635f10df
共有 2 个文件被更改,包括 17 次插入0 次删除
  1. 15 0
      compiler/ptype.pas
  2. 2 0
      tests/webtbs/tw28674.pp

+ 15 - 0
compiler/ptype.pas

@@ -122,6 +122,7 @@ implementation
     procedure resolve_forward_types;
       var
         i: longint;
+        tmp,
         hpd,
         def : tdef;
         srsym  : tsym;
@@ -153,6 +154,20 @@ implementation
                      if assigned(srsym) and
                         (srsym.typ=typesym) then
                       begin
+                        if (sp_generic_dummy in srsym.symoptions) and
+                            not (ttypesym(srsym).typedef.typ=undefineddef) and
+                            assigned(def.owner.defowner) then
+                          begin
+                            { is the forward def part of a specialization? }
+                            tmp:=tdef(def.owner.defowner);
+                            while not tstoreddef(tmp).is_specialization and assigned(tmp.owner.defowner) do
+                              tmp:=tdef(tmp.owner.defowner);
+                            { if the genericdef of the specialization is the same as the
+                              def the dummy points to, then update the found symbol }
+                            if tstoreddef(tmp).is_specialization and
+                                (tstoreddef(tmp).genericdef=ttypesym(srsym).typedef) then
+                              srsym:=tstoreddef(tmp).typesym;
+                          end;
                         tabstractpointerdef(def).pointeddef:=ttypesym(srsym).typedef;
                         { avoid wrong unused warnings web bug 801 PM }
                         inc(ttypesym(srsym).refs);

+ 2 - 0
tests/webtbs/tw28674.pp

@@ -10,6 +10,8 @@ type
     link: ^node;
   end;
 
+  tintnode = specialize node<int32>;
+
 begin
 
 end.