Help with template problem

Janice Caron caron800 at googlemail.com
Tue Nov 6 04:41:37 PST 2007


The following is a simplified version of my program. It won't compile.
The error lines are marked with comments. What's going on, and how do
I fix it? Is this a bug in my code? Or in the compiler? Or what?

///////////////////////////////////
module main;

class A(uint N)
{
    uint n = 0;

    this()
    {
        uint m = n; // Error: this for n needs to be type A not type
main.A!(N).A
                    // class main.A!(N).A member n is not accessible
    }
}

void doTest(uint N)()
{
    auto a = new A!(N)(); // template instance main.A!(N) error instantiating
}

int main()
{
    doTest!(1)();
    doTest!(2)(); // template instance main.doTest!(2) error instantiating

    auto a = new A!(N)();
    return 0;
}



More information about the Digitalmars-d mailing list