fpc/tests/webtbs/tw19498.pp
svenbarth 04683c5f13 pgenutil.pas, generate_specialization:
- Remove unneeded check for "parse_generic" (it's already checked in the outer if-clause).
+ Check whether we are trying to specialize one of the surrounding type declarations of a
  nested type (as long as nested generics are forbidden this is always the outermost generic
  or specialization). This check can not rely on the symbol, because while parsing the
  generic or the specialization the symbol's def is still an errordef. This fixes 
  Mantis #19498 .

+ Added test from bug report.

git-svn-id: trunk@20247 -
2012-02-04 14:20:26 +00:00

28 lines
394 B
Plaintext

{ %NORUN }
{$MODE OBJFPC} { -*- text -*- }
program tw19498;
type
generic TFoo1 <T> = class
type
TFoo2 = class
constructor Create(Owner: specialize TFoo1<T>);
end;
end;
constructor TFoo1.TFoo2.Create(Owner: specialize TFoo1<T>);
begin
end;
type
TIntegerFoo1 = specialize TFoo1<Integer>;
var
Foo1: TIntegerFoo1;
Foo2: TIntegerFoo1.TFoo2;
begin
end.