In the following testcase, A::B is a private type of A, yet function f has no trouble manipulating it. The error is detected by gcc neither in the definition of f nor in its instantiation in g.
class A { struct B { B(); }; }; template<typename T> void f() { A::B b; } void g() { f<int>(); } Tested with the 4.3.3 release and the 20090912 snapshot of 4.5.0. -- Summary: No access control for classes in template functions Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: guillaume dot melquiond at inria dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41437