When there is a default template parameter based on a templated class member type, the compiler dies a nasty death. As far as I can tell, gcc prior to 4.1 branch works fine, but all of the 4.1 branch seems to have this problem.
Quick summary... This works: template<class T, Al=typename Factory0Arg<T>::template Factory<T> > class thing {/*...*/}; This ICEs: template<class T, Al=class Factory0Arg<T>::Factory<T> > class thing {/*...*/}; whenever you try to instantiate 'thing', as seen below: $ g++ -Wall bug.cc -o bug bug.cc: In instantiation of Factory0Arg<foo>::Factory<foo>: bug.cc:41: instantiated from void thing<T, Al>::makeIt() [with T = foo, Al = Factory0Arg<foo>::Factory<foo>] bug.cc:53: instantiated from here bug.cc:19: internal compiler error: in instantiate_class_template, at cp/pt.c:5666 I would at least hope for a better error message assuming that's not valid syntax ;) I'll attach original and preprocessed source. -- Summary: Internal Compiler Error on instantiation of template parameter Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ejt at andrew dot cmu dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32029