Hi folks,
I have have upgraded my compiler (gcc 3.3 -> 3.4) and the new version
performs two-stage (or dependent) name lookup:
http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html
Given a templated base class:
template <class T> struct Base
{
int f();
int i;
};
Following derived class doesn't compile anymore:
template <class T> struct Derived : public Base<T>
{
int g() { return i; }
int h() { return f();}
};
The correct implementation is:
template <class T> struct Derived : public Base<T>
{
int g() { return Base<T>::i; }
int h() { return Base<T>::f();}
};
This looks quite confusing, especially when you combine more members of the
base class in an expression.
The gcc docs suggest: "Alternatively, Base<T>::i might be brought into scope
by a using-declaration."
And here is my problem: what is the correct syntax of this using
declaration?
"using Base<T>::i;" doesn't work?
Regards,
Torsten