// PR c++/79501 // { dg-do compile { target c++17 } } struct X { protected: template struct B { T t; }; template B(T) -> B; }; struct Y { protected: template struct B { T t; }; private: template B(T) -> B; // { dg-error "access" } };