This code, compiled with trunk: template<typename _Tp, typename _Alloc> class list { struct iterator;
struct const_iterator; }; template<typename _Tp, typename _Alloc> struct list<_Tp, _Alloc>::iterator { }; #if 0 template<typename _Tp, typename _Alloc> inline bool operator!=(const typename list<_Tp, _Alloc>::iterator& __x, const typename list<_Tp, _Alloc>::const_iterator& __y) { return __x._M_node != __y._M_node; } #else template<typename _Tp, typename _Alloc> inline bool operator!=(const list<_Tp, _Alloc>::iterator& __x, const list<_Tp, _Alloc>::const_iterator& __y) { return __x._M_node != __y._M_node; } #endif gives: %g++ -c test.cc test.cc:24: error: expected unqualified-id before & token test.cc:24: error: expected ) before & token test.cc:24: error: expected initializer before & token Hmmm. Yeah. Here's something more useful: %g++ -c test.cc test.cc:24: error: expected typename before qualified-id -- Summary: missing typename error improvement Product: gcc Version: unknown Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bkoz at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40738