http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50400
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-15 09:34:52 UTC --- EDG accepts it too, are you suggesting MSVC is right and all the others wrong? That would be a first ;) See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#318 Because the constructor Impl::Impl is not an acceptable lookup result in the expression X::Impl::Impl::foo the second "Impl" names the class itself, and so the code is valid and G++ is correct