Comment #0 by jarrett.billingsley — 2007-11-13T14:13:55Z
struct S
{ // line 34 is this brace.
int x;
}
template Foo(T)
{
alias Tuple!(T.init) Foo;
}
alias Tuple!(Foo!(S)) t;
dtest.d(34): declaration _D5dtest1S6__initZ forward declaration
RRRRRRRRRGHHHHHHHH
GHASDIGHGHHGGH
GGGGGGGGGGGGGGG
Comment #1 by jarrett.billingsley — 2008-11-12T20:01:03Z
*** Bug 2449 has been marked as a duplicate of this bug. ***
Comment #2 by smjg — 2008-11-13T19:10:14Z
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.
Comment #3 by jarrett.billingsley — 2008-11-13T20:03:58Z
(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.
Comment #4 by k.hara.pg — 2013-11-22T02:16:40Z
D1 is no longer supported. And same issue does not exist in D2.