https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29040
--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> --- My draft doesn't the templated case: struct c { private: template<typename> struct n { int j; }; }; struct d:public c { template<typename T> void f (struct n<T> *p); }; Interestingly, currently we neither handle correctly a version of it without the class-key: struct c { private: template<typename> struct n { int j; }; }; struct d:public c { template<typename T> void f (/*struct*/ n<T> *p); }; but maybe it's just a special case of our long standing issues with access control vs templates.