class Base
{
public: void foo(){}
};
class Derived : public Base
{
private:
using Base::foo;
};
int main()
{
Derived d;
d.foo();
}
Is the code legal? The declaration using Base::foo is in the private section of the derived class. So the call d.foo() shouldn’t compile, am I right?
The Standard in section 11.2/4 says
However the Standard also says that
In your code the access of the member
foohas been changed in the derived class. So the code shouldn’t compile but this is still an active issue with open status So some compilers compile the code (Comeau and Intel C++) whereas g++ and MSVC++ (correctly) reject it.