Hi all. The following testcase currently triggers an ICE in 4.1, 4.2 and 4.3: === cut here === class QGList; // L1 unsigned count() { class QGListIterator { friend class QGList; // L2 QGListIterator( const QGList & ); }; } === cut here === If I read the standard properly, the friend declaration in L2 introduces a local class QGList, which must not be taken into account during name lookup, it is therefore marked as "hidden" (front-end term). When QGList is looked up in QGListIterator's constructor, the local QGList is found, and an assertion fails in 'name_lookup_real', hence the ICE. This assertion ensures that only namespace-scope bindings are hidden; this constraint is not verified in our case: we have a hidden and non namespace-scope binding (the local QGList). The attached patch fixes this by ensuring that if the binding is hidden, we are processing a local class. Moreover, the lookup will fail because there is no suitable declaration for QGList: the local one coming from the friend declaration is not a candidate, nor is the one at L1 (only a declaration in the innermost enclosing nonclass scope - that is 'count' - is to be found). In other words, this testcase is invalid, and the compiler will output an error (however, please note that icc accepts this snippet, so my interpretation might be wrong...). I have successfully regtested this on i686-pc-linux-gnu. Is it OK for mainline? For 4.2? Best regards, Simon :ADDPATCH c++: