Recursive data structure using template won't compile

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Thu Nov 8 03:33:03 PST 2012


On Thu, 08 Nov 2012 07:39:27 +0100
"Rob T" <rob at ucora.com> wrote:

> I want to create a simple recursive data structure as follows:
> 
> struct R
> {
>     int value;
>     d_list!R Rlist;
> }
> 
> // d-linked list with templated payload
> struct d_list( T )
> {
>     struct node
>     {
>        T payload;
>        node* pred;
>        node* succ;
>     }
>     node* head;
>     node* tail;
> }
> 
> The compiler complains about node having "forward references".
> 

Looks like a compiler bug. You should report it:
http://d.puremagic.com/issues/





More information about the Digitalmars-d-learn mailing list