I think i found a bug in gcc 4.3.2. The following code sample should
not compile, though it does:
template<class T>
class A {
public:
int foo();
};
template<class T>
class B : protected A<T> { // also works with private inheritance
protected: // also with private:
using A<T>::foo; // this injects A<T>::foo into the scope, so
B<T>::foo should be protected, right ?
};
int main ( int, char**) {
B<int> bar;
bar.foo(); // shouldn't compile: foo is protected
return 0;
}
It seems that the using-declaration makes A<T>::foo public no matter
what.
When A and B are regular non-template classes however, the behavior is
correct.
Best regards,
Max