// Note that 'field' is indeed a private member of X but that access
// is indeed ultimately constrained by the protected inheritance from Y.
// If someone wants to put the effort into improving this diagnostic,
// they can feel free; even explaining it in person would be a pain.
namespacetest4{
classZ;
classX{
public:
voidf(Z*p);
private:
intfield;// expected-note {{member is declared here}}
};
classY:publicX{};
classZ:protectedY{};// expected-note 2 {{constrained by protected inheritance here}}
voidX::f(Z*p){
p->field=0;// expected-error {{cannot cast 'test4::Z' to its protected base class 'test4::X'}} expected-error {{'field' is a private member of 'test4::X'}}