bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using-declaration visibility with dependent base-class


From: chombier
Subject: using-declaration visibility with dependent base-class
Date: Tue, 4 Nov 2008 08:21:19 -0800 (PST)
User-agent: G2/1.0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]