fpc/tests/webtbs/tw20871.pp
svenbarth ef10ce3bd0 * pgenutil.pas, generate_specialization:
When parsing an inline specialization inside a generic we need to 
	respect the "parsedtype" parameter which tells us whether the first
	generic parameter was already parsed. This fixes Mantis #20871 .
+ added test for this

git-svn-id: trunk@20251 -
2012-02-04 16:26:47 +00:00

39 lines
683 B
ObjectPascal

{ %NORUN }
program tw20871;
{$MODE delphi}
{$DEFINE CAUSE_ERROR}
type
TInterior<TValue> = class end;
TExterior<TValue> = class
strict private
FInterior: TInterior<TValue>;
public
constructor Create;
destructor Destroy; override;
end;
constructor TExterior<TValue>.Create;
{$IFDEF CAUSE_ERROR}
begin
FInterior := TInterior<TValue>.Create;
{ ^ Compiler reports here that “<” is expected }
{$ELSE}
type
TSpecializedInterior = TInterior<TValue>;
begin
FInterior := TSpecializedInterior.Create;
{$ENDIF}
end;
destructor TExterior<TValue>.Destroy;
begin
FInterior.Free;
end;
begin
TExterior<Integer>.Create.Free;
end.