Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using-declaration visibility with dependent base-class

2 views
Skip to first unread message

chom...@gmail.com

unread,
Nov 4, 2008, 11:21:19 AM11/4/08
to
Hello,

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

0 new messages