2
0
Эх сурвалжийг харах

Merged revisions 8144 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r8144 | peter | 2007-07-23 01:10:24 +0200 (Mon, 23 Jul 2007) | 2 lines

* don't allow generics as parent classes

........

git-svn-id: branches/fixes_2_2@8235 -

peter 18 жил өмнө
parent
commit
9438d57f6f

+ 1 - 0
.gitattributes

@@ -7226,6 +7226,7 @@ tests/webtbf/tw8398.pp svneol=native#text/plain
 tests/webtbf/tw8528.pp svneol=native#text/plain
 tests/webtbf/tw8583.pp svneol=native#text/plain
 tests/webtbf/tw8588.pp svneol=native#text/plain
+tests/webtbf/tw8591.pp -text
 tests/webtbf/tw8738.pas svneol=native#text/plain
 tests/webtbf/tw8777a.pp svneol=native#text/plain
 tests/webtbf/tw8777b.pp svneol=native#text/plain

+ 8 - 0
compiler/pdecobj.pas

@@ -439,6 +439,14 @@ implementation
               hasparentdefined:=true;
             end;
 
+          { no generic as parents }
+          if assigned(childof) and
+             (df_generic in childof.defoptions) then
+            begin
+              Message(parser_e_no_generics_as_types);
+              childof:=nil;
+            end;
+
           { if no parent class, then a class get tobject as parent }
           if not assigned(childof) then
             begin

+ 13 - 0
tests/webtbf/tw8591.pp

@@ -0,0 +1,13 @@
+{ %fail }
+
+{$mode objfpc}
+
+type
+  generic TG1<T> = class
+  end;
+
+  generic TG2<T> = class(TG1)
+  end;
+
+begin
+end.