Question Details

No question body available.

Tags

c++ language-lawyer c++98

Answers (2)

May 8, 2026 Score: -1 Rep: 8,361 Quality: Low Completeness: 50%

The answer is NO. And i would like to say I have no idea why some standard compiler would accept it , the reason is simple.

For implementing the using declaration like this

accessspecifier://can be public or protected 
using ParentClass::membervariable  

is only meant to promote the access of the member variable of base class from protected to public or private to protected , etc, BUT only for the members that the child class has access to. But you DO NOT as is the case for private inheritance(relationship is implemented in-terms-of and not is-a). No child class has direct access to private members of the base class.

May 8, 2026 Score: -1 Rep: 50,419 Quality: Low Completeness: 70%

The program is ill-formed as per namespace.udecl#14:

In a using-declarator that does not name a constructor, every declaration named shall be accessible. In a using-declarator that names a constructor, no access check is performed.

And since the given using-declarator(s) do not name a ctor and the member are not accessible(as A is a private base), clang and edg are wrong to not give any diagnostic.