www.digitalmars.com         C & C++   DMDScript  

D - template error

reply Paul Runde <prunde consolidated.net> writes:
//test.d

struct block
{
    int x;
    int y;
    int x1;
    int x2;
}

typedef block lblock;

template vector(T)
{
    T buf;

    T get()
    {
       return buf;
    }
}

instance vector(lblock) foo;


int main(char[][] args)
{
    lblock b = foo.get();

    return 0;
}

/*
    This code will not compile -- Internal error: ..\ztc\cod1.c 1637
    It will compile if I make foo an instance of vector(block) instead 
of lblock.
    OR
    It will compile if x1 and x2 in block are commented out.

    I know the code won't run if compiled -- I pruned off everything I 
didn't need to reproduce the error.
*/

Paul
Aug 01 2003
parent "Walter" <walter digitalmars.com> writes:
Thanks, I can take it from here. -Walter
Aug 02 2003