https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79308
Bug ID: 79308 Summary: Internal compilation error on specialization of nested template classes Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bjh...@sags-per-mail.de Target Milestone: --- Created attachment 40639 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40639&action=edit Source code The following code (attached as element.cpp) causes the error internal compiler error: in finish_member_declaration, at cp/semantics.c:2966 when compiled by calling gcc -v -save-temps -Wall -Wextra -std=c++11 element.cpp with GCC 6.3.0. The nearly same error is caused by GCC 5.4.1 and GCC 4.8. --------------------------------------- template <class> struct Element { Element(void) { WriteOutput<int>(); } template <typename> struct WriteOutput { }; }; template <> template <typename InnerType> struct Element<int>::WriteOutput<InnerType> { // line mentioned in error message void foo(void) { } virtual void bar(void) { } }; Element<int> e; --------------------------------------- The error disappears on each of the following changes: * Remove one of the element functions in the specialization. * Remove the "virtual" of all element functions. * Make the specialized type-argument of the outer template different from the unspecialized template type-argument of the nested template. As long as they are the same, no matter which actually, the error is triggered. In these case the compiler complains correctly about the missing main function. If I find out how to attach another file I will attach the whole compiler output.