Hi,
When i try to specialize generics in a generic, FPC wants me to give more types
for specialization (of the containing generic) where IMO only one is needed.
The code:
{$mode objfpc} {$h+}
program test;
uses classes, sysutils;
type
generic TNode = class
var
public
Data: T;
constructor Create;
destructor Destroy; override;
end;
generic TContainer = class
public
type
TTNode = specialize TNode;
TTNodeNode = specialize TNode;
TTNodeNodeRec = record
ANode: TTNodeNode;
end;
TTNodeNodeRecNode = specialize TNode;
var
public
Data: TTNodeNodeRecNode;
constructor Create;
destructor Destroy; override;
end;
TAContainer = specialize TContainer;
--^ (30, 51)
constructor TNode.Create;
begin
end;
destructor TNode.Destroy;
begin
inherited Destroy;
end;
constructor TContainer.Create;
begin
end;
destructor TContainer.Destroy;
begin
inherited Destroy;
end;
var
AContainer: TAContainer;
begin
end.
[1049] [EMAIL PROTECTED]:~/Dev/Tests
% fpc test.pp
Free Pascal Compiler version 2.3.1 [2007/12/27] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pp
test.pp(30,51) Fatal: Syntax error, "," expected but ">" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not
specify a source file to be compiled)
Never having written any generic code i am not sure whether there is a problem
in my code or in fpc. I hope somebody can enlighten me once again ;)
Thank you in advance.
bartek.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal