http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47346
--- Comment #3 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-08-11 18:52:54 UTC --- Created attachment 24985 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24985 Work in progress patch I am currently testing this patch. The problem I see is twofold. First, the infrastructure I added a while back to do access checking of references to types, at template instantiation time, was limited to typedefs. This bug seems to suggest that the access checking should be done for references to all types. Not just typedefs. Second, add_typedef_to_current_template_for_access_check assumes that a "current template" is present. When we are parsing the class header (for e.g the base clause) or the template parameter list, the "current template" is not present yet. In that case, a possible solution is the stash away, for some short while, the types access that is to be checked, until the current template becomes available. This is the approach taken by this patch.