[Bug c++/79308] ICE on specialization of nested template classes (in finish_member_declaration, at cp/semantics.c:2963)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79308 --- Comment #6 from bjhend --- (In reply to Volker Reichelt from comment #5) > IMHO the testcase is invalid (e.g. clang rejects it). > But by changing the line > struct Element::WriteOutput > into > struct Element::WriteOutput > it can be turned into a valid testcase. Yes, you're right. It's the generic definition of the inner template so the additional shouldn't be there. Thanks for correcting this. > There are several similar testcases, so I opened a new PR 89744 for this. Thanks.
[Bug c++/79308] New: Internal compilation error on specialization of nested template classes
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 struct Element { Element(void) { WriteOutput(); } template struct WriteOutput { }; }; template <> template struct Element::WriteOutput { // line mentioned in error message void foo(void) { } virtual void bar(void) { } }; Element 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.
[Bug c++/79308] Internal compilation error on specialization of nested template classes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79308 --- Comment #1 from bjhend --- Created attachment 40640 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40640&action=edit Complete compiler output
[Bug c++/79308] ICE on specialization of nested template classes (in finish_member_declaration, at cp/semantics.c:2963)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79308 --- Comment #3 from bjhend --- (In reply to Martin Liška from comment #2) > Confirmed, all releases I have ICE (4.5.0+). Hi Martin, thanks for confirmation. You also added the keyword ice-on-INvalid-code, but I think the code is valid. The C++-11 standard, paragraph 14.7.3, clause 5 contains a similar example (see nested template struct C) with a single element function. Additionally, I cannot find anything in the text, saying that this code is invalid, but I might be wrong in interpreting the standard.