http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46983
Summary: Diagnostic about change in meaning of name in class misses some cases Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: java AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org CC: ja...@gcc.gnu.org, r...@gcc.gnu.org In C++, it is ill-formed, no diagnostic required, for a lookup to have different meanings at the point of lookup and in the context of the complete class. G++ gives diagnostics about some instances of this, but misses this one: template <class T> struct A { typedef typename T::Y Z; }; struct B { typedef int Y; }; struct C: B { struct N: A<C> { }; typedef char Y; }; int ar[sizeof(C::N::Z) == sizeof(int) ? 1 : -1]; Here when we instantiate A<C>, C is not yet complete, so when we lookup C::Y we find B::Y. If we were to do the lookup in the full class, it would find C::Y instead.