diff --git a/.gitattributes b/.gitattributes index 0e12e163cd..eeab6334d2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13938,6 +13938,7 @@ tests/webtbs/tw25956.pp svneol=native#text/pascal tests/webtbs/tw25959.pp svneol=native#text/pascal tests/webtbs/tw2602.pp svneol=native#text/plain tests/webtbs/tw2607.pp svneol=native#text/plain +tests/webtbs/tw26123.pp svneol=native#text/pascal tests/webtbs/tw26162.pp svneol=native#text/pascal tests/webtbs/tw26180.pp svneol=native#text/pascal tests/webtbs/tw2620.pp svneol=native#text/plain diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index a546d25ea7..3e8c21cffb 100644 --- a/compiler/pdecobj.pas +++ b/compiler/pdecobj.pas @@ -1397,9 +1397,9 @@ implementation { usage of specialized type inside its generic template } if assigned(genericdef) then - current_specializedef:=current_structdef + current_specializedef:=current_structdef; { reject declaration of generic class inside generic class } - else if assigned(genericlist) then + if assigned(genericlist) then current_genericdef:=current_structdef; { nested types of specializations are specializations as well } diff --git a/tests/webtbs/tw26123.pp b/tests/webtbs/tw26123.pp new file mode 100644 index 0000000000..1ef7babac0 --- /dev/null +++ b/tests/webtbs/tw26123.pp @@ -0,0 +1,25 @@ +{ %NORUN } + +program tw26123; + +{$mode objfpc} + +type + generic TNode = class // anything can go in this class + end; + + generic TLinkedList = class + type + specialized_TNode = specialize TNode; + public + node : specialized_TNode; + end; + + + generic TExtendedLinkedList = class (specialize TLinkedList) + public + last_node : specialized_TNode; + end; + +begin +end.