https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85242
Bug ID: 85242 Summary: [6/7/8 Regression] ICE with invalid template parameter Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following invalid code snippet triggers an ICE on trunk since GCC 6.1.0: ========================================== namespace N { struct A {}; } template<struct N::A {}> void foo(); ========================================== ' in dump_template_decl, at cp/error.c:1305 template<struct N::A {}> void foo(); ^ 0x7163e0 dump_template_decl ../../gcc-6.1.0/gcc/cp/error.c:1305 0x718bf2 decl_to_string ../../gcc-6.1.0/gcc/cp/error.c:2955 0x718bf2 cp_printer ../../gcc-6.1.0/gcc/cp/error.c:3535 0x14b50b8 pp_format(pretty_printer*, text_info*) ../../gcc-6.1.0/gcc/pretty-print.c:631 0x14b0928 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc-6.1.0/gcc/diagnostic.c:823 0x14b17ed error(char const*, ...) ../../gcc-6.1.0/gcc/diagnostic.c:1152 0x644646 duplicate_decls(tree_node*, tree_node*, bool) ../../gcc-6.1.0/gcc/cp/decl.c:1609 0x81664c pushdecl_maybe_friend_1 ../../gcc-6.1.0/gcc/cp/name-lookup.c:805 0x81664c pushdecl_maybe_friend(tree_node*, bool) ../../gcc-6.1.0/gcc/cp/name-lookup.c:1298 0x819753 pushdecl_with_scope_1 ../../gcc-6.1.0/gcc/cp/name-lookup.c:2295 0x81983c pushdecl_with_scope(tree_node*, cp_binding_level*, bool) ../../gcc-6.1.0/gcc/cp/name-lookup.c:2309 0x8198ef pushdecl_namespace_level(tree_node*, bool) ../../gcc-6.1.0/gcc/cp/name-lookup.c:3915 0x6b5e30 push_template_decl_real(tree_node*, bool) ../../gcc-6.1.0/gcc/cp/pt.c:5392 0x72f2da cp_parser_class_head ../../gcc-6.1.0/gcc/cp/parser.c:21951 0x72f2da cp_parser_class_specifier_1 ../../gcc-6.1.0/gcc/cp/parser.c:21285 0x72f2da cp_parser_class_specifier ../../gcc-6.1.0/gcc/cp/parser.c:21582 0x72f2da cp_parser_type_specifier ../../gcc-6.1.0/gcc/cp/parser.c:15836 0x743571 cp_parser_decl_specifier_seq ../../gcc-6.1.0/gcc/cp/parser.c:12760 0x7451e6 cp_parser_parameter_declaration ../../gcc-6.1.0/gcc/cp/parser.c:20437 0x7467e9 cp_parser_template_parameter ../../gcc-6.1.0/gcc/cp/parser.c:14543 Please submit a full bug report, [etc.] Note that the compiler even fails to properly emit the "internal compiler error" message. GCC 4.4 - GCC 5 wrongly accepted the code.