1 msggfortran read file error during openmp parallel do
1 msgHelp with long jumps and ARM exception vector

typedef in templated base class, won't compile
\ John Gateley (25 Oct 2007)
. \ Olivier Delannoy (25 Oct 2007)

6 msghow to compute offset of data member at compile...
5 msgI miss a gcc warning
1 msg[Bug g++ 3.4.4 ?] g++, -O2, static member data ...
3 msgcustom stdc++
2 msglinking libraries without name prefix/suffix
2 msgSeeing changes made by optimization option
1 msgownership of files when running gcc under setuid
1 msgsysroot package gpl-include open-source or Red ...
3 msgEXC_BAD_ACCESS exceptions
1 msgbloatwatch - how to count macro expansions per ...
5 msgRe: register variables: list?
2 msgsegfault in libc.so.6
4 msg[Update] : Problem while building/compiling Gcc...
3 msgFloating point results change with different co...
1 msgHow to know the number of spills
1 msgRe: Unable to use the -c option
9 msgLibtool versioning on FreeBSD
Subject:typedef in templated base class, won't compile
Group:Gcc-help
From:John Gateley
Date:25 Oct 2007


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>


© 2004-2008 readlist.com