http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51661
Bug #: 51661 Summary: ICE when template class list repeated Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ca...@cs.stanford.edu g++ crashes when compiling this program: namespace { template<class T> struct s{s();}; template<class T> s<T><T>::s(){} extern template struct s<int>; } How to run: g++ prog.cpp Output: prog.cpp:4:19: error: ‘{anonymous}::s<T>’ is not a template prog.cpp:4:30: error: declaration of ‘{anonymous}::s<T> s()’ not in a namespace surrounding ‘::’ prog.cpp:4:30: error: ‘{anonymous}::s<T> s()’ should have been declared inside ‘::’ prog.cpp:5:24: error: using typedef-name ‘s<int>’ after ‘struct’ prog.cpp:5:24: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘template_id_expr’ in check_elaborated_type_specifier, at cp/decl.c:11443 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Compiler version: COLLECT_GCC=/new-gcc/i-4.7/bin/g++ COLLECT_LTO_WRAPPER=/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../s-4.7/configure --prefix=/new-gcc/i-4.7 Thread model: posix gcc version 4.7.0 20111223 (experimental) (GCC)