April 24, 2004
Help: What am I doing wrong?

----------------------
struct test(T) {
        test!(T) func() {
                test!(T) res;
                return res;
        };
};

int main() {
        test!(int) a;
        a = a.func();
        return 0;
};
----------------------

The gdc tells me
"template instance test!(int) test is not a template declaration"


April 24, 2004
"Norbert Nemec" <Norbert.Nemec@gmx.de> wrote in message news:c6dlsg$235$1@digitaldaemon.com...
> Help: What am I doing wrong?
>
> ----------------------
> struct test(T) {
>         test!(T) func() {
>                 test!(T) res;
>                 return res;
>         };
> };

I think that everyone has this problem at first (I did)
The solution is very simple:
struct test(T) {
        .test!(T) func() {
                .test!(T) res;
                return res;
        }
}

The solution is . (gives acces to outer scope)
and you don't need ; after struct and function declaration.


> int main() {
>         test!(int) a;
>         a = a.func();
>         return 0;
> };
> ----------------------
>
> The gdc tells me
> "template instance test!(int) test is not a template declaration"
>
>