With this setup:
template<int N>
struct Base {
void foo();
};
class Derived : Base<1> {
static void bar(Derived *d) {
//No syntax errors here
d->Base<1>::foo();
}
};
Everything works fine. However, with this example:
template<class E>
struct Base {
void foo();
};
template<class E>
class Derived : Base<E> {
static void bar(Derived<E> *d) {
//syntax errors here
d->Base<E>::foo();
}
};
I get:
error: expected primary-expression before '>' token
error: '::foo' has not been declared
What's the difference? Why does the second cause a syntax error?