typedef in templated base class, won't compile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I'm having problems using typedef within a templated base class:

    #include <stdio.h>

    template<class TEMPLATE_ARG>
    class Base
    {
    public:
      typedef int MyType;
    };

    template<class TEMPLATE_ARG>
    class Child : public Base<TEMPLATE_ARG>
    {
    public:
      MyType *MakeObject();
    };

The compiler is complaining about "MyType *MakeObject();":
NestedTypedef.C:14: error: ISO C++ forbids declaration of 'MyType' with no type
NestedTypedef.C:14: error: expected ';' before '*' token

If I remove the template from the Base class, it compiles fine.

Any hints on why this won't work or what I could do to make it work?
Note that MyType is not templated, even though the base class is (and in
my short example, I don't use the TEMPLATE_ARG but in the actual code I do).

Thanks,

j
-- 
John Gateley <gateley@xxxxxxxxxx>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux