http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52212
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-12 15:04:41 UTC --- http://open-std.org/JTC1/SC22/WG21/docs/cwg_closed.html#209 you can make it valid by making D a friend of E, so that it can access the name E::F class D { class E{ class F{}; friend void foo1(D::E::F& q); friend class D; }; friend void foo1(D::E::F& q); }; works with G++ and Comeau online and the online clang demo