[Issue 1667] Forward reference to struct initializer in template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 13 18:03:59 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1667





------- Comment #3 from jarrett.billingsley at gmail.com  2008-11-13 20:03 -------
(In reply to comment #2)
> Is this really a forward reference issue?  There is no forward reference in the
> code.  Moreover, under DMD 1.036 it generates a quite different set of errors:
> 
> bz1667.d(8): template instance identifier 'Tuple' is not defined
> bz1667.d(11): template instance bz1667.Foo!(S) error instantiating
> bz1667.d(11): template instance identifier 'Tuple' is not defined
> 
> It's true that the errors change if the pieces are swapped around - if the
> alias t is moved to the top
> 
> bz1667.d(1): template instance forward reference to template declaration Foo(T)
> bz1667.d(1): template instance identifier 'Tuple' is not defined
> 
> but that's not the problem being reported here.

My bad, I didn't include the definition of Tuple.  

struct S
{
        int x;
}

template Tuple(T...)
{
        alias T Tuple;
}

template Foo(T)
{
        alias Tuple!(T.init) Foo;
}

alias Tuple!(Foo!(S)) t;

That gives the reported error, even in 1.036.


-- 



More information about the Digitalmars-d-bugs mailing list