Browse Source

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 9 years ago
parent
commit
d4635f10df
2 changed files with 17 additions and 0 deletions
  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;
     procedure resolve_forward_types;
       var
       var
         i: longint;
         i: longint;
+        tmp,
         hpd,
         hpd,
         def : tdef;
         def : tdef;
         srsym  : tsym;
         srsym  : tsym;
@@ -153,6 +154,20 @@ implementation
                      if assigned(srsym) and
                      if assigned(srsym) and
                         (srsym.typ=typesym) then
                         (srsym.typ=typesym) then
                       begin
                       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;
                         tabstractpointerdef(def).pointeddef:=ttypesym(srsym).typedef;
                         { avoid wrong unused warnings web bug 801 PM }
                         { avoid wrong unused warnings web bug 801 PM }
                         inc(ttypesym(srsym).refs);
                         inc(ttypesym(srsym).refs);

+ 2 - 0
tests/webtbs/tw28674.pp

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