Browse Source

Fix for Mantis #24953.

pgenutil.pas, parse_generic_parameters:
  * set the typesym of the newly created def so that inline specializations in pexpr.pas, sub_expr can check it correctly

git-svn-id: trunk@25410 -
svenbarth 12 years ago
parent
commit
d03507671d
3 changed files with 29 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/pgenutil.pas
  3. 24 0
      tests/webtbs/tw24953.pp

+ 1 - 0
.gitattributes

@@ -13512,6 +13512,7 @@ tests/webtbs/tw24865.pp svneol=native#text/pascal
 tests/webtbs/tw24871.pp svneol=native#text/pascal
 tests/webtbs/tw2492.pp svneol=native#text/plain
 tests/webtbs/tw2494.pp svneol=native#text/plain
+tests/webtbs/tw24953.pp svneol=native#text/pascal
 tests/webtbs/tw2503.pp svneol=native#text/plain
 tests/webtbs/tw2504.pp svneol=native#text/plain
 tests/webtbs/tw2514.pp svneol=native#text/plain

+ 4 - 0
compiler/pgenutil.pas

@@ -1009,6 +1009,10 @@ uses
 
               for i:=firstidx to result.count-1 do
                 ttypesym(result[i]).typedef:=basedef;
+              { we need a typesym in case we do a Delphi-mode inline
+                specialization with this parameter; so just use the first sym }
+              if not assigned(basedef.typesym) then
+                basedef.typesym:=ttypesym(result[firstidx]);
               firstidx:=result.count;
 
               constraintdata.free;

+ 24 - 0
tests/webtbs/tw24953.pp

@@ -0,0 +1,24 @@
+unit tw24953;
+
+interface
+{$mode delphi}
+
+Type
+   TPoolablePool<t:class,constructor>   =   class
+                                        factory : TObject;
+                                        constructor create;
+                                      end;
+
+   TPoolableFactory<t>= class
+   end;
+
+implementation
+
+{ TPoolablePool<t> }
+
+constructor TPoolablePool<t>.create;  // last line visible in -va output before crash
+begin
+  factory:=TPoolableFactory<t>.create;
+end;
+
+end.