I'm porting a program over to gcc, and I get the following error quite a bit:
foo.cpp:7:2: error: ‘type’ does not name a type
foo.cpp:7:2: note: (perhaps ‘typename A<xii>::type’ was intended)
foo.cpp:8:15: error: ‘type’ has not been declared
with this code:
Code:
template <typename foo> class A {
public:
typedef int type;
};
template <typename xii> class B: public A<xii> {
type ham;
void cheese (type *) { }
};
int main (void) {
return 0;
}
I have found that I can workaround the issue by adding this typedef to class B, but it is cumbersome for classes inheriting large amounts of typedefs.
Code:
template <typename xii> class B: public A<xii> {
typedef typename A<xii>::type type;
type ham;
void cheese (type *) { }
};
Anyhow my questions...
1) Is there a less cumbersome way for me to pull in all of the typenames from the parent template A into B?
2) Where can I find the actual C++ specifications for this behavior?
Specifically, this is occuring on gcc version 4.5.1