https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95935
Bug ID: 95935 Summary: ICE : Segmentation fault Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE with Segmentation fault. $cat bug.cc enum struct a; template <class = enum struct a { b; template <> enum struct a { $g++ bug.cc bug.cc:2:36: error: expected ‘}’ before ‘;’ token 2 | template <class = enum struct a { b; | ~ ^ bug.cc:2:36: error: expected ‘>’ before ‘;’ token bug.cc:2:36: error: expected unqualified-id before ‘;’ token bug.cc:4: error: expected identifier at end of input bug.cc:4: error: expected ‘}’ at end of input bug.cc:3:27: note: to match this ‘{’ 3 | template <> enum struct a { | ^ bug.cc:2:35: internal compiler error: Segmentation fault 2 | template <class = enum struct a { b; | ^ 0xfe451f crash_signal ../../gcc/toplev.c:328 0x1295faa copy_node(tree_node*) ../../gcc/tree.c:1186 0x9121bc finish_enum_value_list(tree_node*) ../../gcc/cp/decl.c:15712 0x9a20f4 cp_parser_enum_specifier ../../gcc/cp/parser.c:19443 0x9a20f4 cp_parser_type_specifier ../../gcc/cp/parser.c:17734 0x9a2a02 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:14410 0x9c8f35 cp_parser_single_declaration ../../gcc/cp/parser.c:29459 0x9ca0f0 cp_parser_explicit_specialization ../../gcc/cp/parser.c:17654 0x9ccac9 cp_parser_declaration ../../gcc/cp/parser.c:13430 0x9cd06a cp_parser_translation_unit ../../gcc/cp/parser.c:4761 0x9cd06a c_parse_file() ../../gcc/cp/parser.c:44043 0xae4dbb c_common_parse_file() ../../gcc/c-family/c-opts.c:1190 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $g++ --version g++ (GCC) 11.0.0 20200626 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.