www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1667] New: Forward reference to struct initializer in template

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1667

           Summary: Forward reference to struct initializer in template
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


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


-- 
Nov 13 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1667






*** Bug 2449 has been marked as a duplicate of this bug. ***


-- 
Nov 12 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1667


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com





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.


-- 
Nov 13 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1667







 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. --
Nov 13 2008