http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52460
Bug #: 52460 Summary: Misleading error message with templated c++ code Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pets...@gmail.com compiling the following: ---8<---8<---8<---8<--- template<typename T> struct Base { typename T::Type var; }; template<typename U> struct Derived : Base<Derived<U> > { typedef U Type; }; void foo() { Derived<int> i; } ---8<---8<---8<---8<--- gives the error gcctempl.cpp: In instantiation of ‘struct Base<Derived<int> >’: gcctempl.cpp:7:8: required from ‘struct Derived<int>’ gcctempl.cpp:13:15: required from here gcctempl.cpp:4:19: error: no type named ‘Type’ in ‘struct Derived<int>’ on all tested gcc versions (4.4, 4.5, 4.6, 4.7). There is definitely a type called 'Type' in struct 'Derived', hence the error message is misleading. I'm not sure, the above code is probably ill-formed, because it creates a circular dependence between the two types, but then, this should be communicated to the user.