https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81866
Bug ID: 81866 Summary: ICE with a default template parameter which is a template class nested in a template class Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lee.deokjae at gmail dot com Target Milestone: --- The following code causes an ICE with GCC 7.1.1. Clang 4.0 and VC++ 2017 compile the code successfully. If I remove the forward declaration of struct C, it removes the error. Or replacing the default template parameter with any template class defined outside A also removes the error. -------------------------------------------------------------------- template<class> struct A { template<class> struct C; template<class> struct B; template<class T = B<int>> struct C {}; }; int main(int, char**) { A<int>::C<> ac; return 0; } -------------------------------------------------------------------- Test.cpp: In instantiation of ‘struct A<int>’: Test.cpp:14:15: required from here Test.cpp:6:31: internal compiler error: in finish_member_declaration, at cp/semantics.c:2976 template<class> struct B;