Yes, this is stated in the C ++ standard, section Β§3.4 [basic.lookup]
Access rules (section 11) are considered only after a successful name search and permission to overload the function (if applicable)
A search by name does not care about accessibility: it finds both A::num and B::num , so there is ambiguity for the compiler.
You can explicitly call A::num with:
C::A::num();
If you are explicitly trying to call B::num , then your compiler will indeed throw an access error:
C::B::num();
You can also explicitly enter the base name in the scope in the derived class, which eliminates the ambiguity:
struct C : public A, private B { using A::num; };
source share