https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95932
Bug ID: 95932 Summary: ICE in redeclare_class_template, at cp/pt.c:6231 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. $cat bug.cc template <template>> struct a < class b{}, struct b { $g++ bug.cc bug.cc:1:19: error: expected ‘<’ before ‘>>’ token 1 | template <template>> struct a < class b{}, struct b { | ^~ bug.cc:1:19: error: expected identifier before ‘>>’ token bug.cc:1:19: error: expected ‘>’ before ‘>>’ token bug.cc:1:19: error: expected ‘class’ or ‘typename’ before ‘>>’ token bug.cc:1:19: error: expected identifier before ‘>>’ token bug.cc:1:19: error: expected ‘>’ before ‘>>’ token bug.cc:1:29: error: ‘a’ is not a class template 1 | template <template>> struct a < class b{}, struct b { | ^ bug.cc:1:40: error: types may not be defined in template arguments 1 | template <template>> struct a < class b{}, struct b { | ^ bug.cc:1:51: internal compiler error: in redeclare_class_template, at cp/pt.c:6231 1 | template <template>> struct a < class b{}, struct b { | ^ 0x652319 redeclare_class_template(tree_node*, tree_node*, tree_node*) ../../gcc/cp/pt.c:6231 0x8fb2e7 xref_tag_1 ../../gcc/cp/decl.c:15043 0x8fb440 xref_tag(tag_types, tree_node*, tag_scope, bool) ../../gcc/cp/decl.c:15085 0x9a1584 cp_parser_class_head ../../gcc/cp/parser.c:24658 0x9a1584 cp_parser_class_specifier_1 ../../gcc/cp/parser.c:23880 0x9a1aa3 cp_parser_class_specifier ../../gcc/cp/parser.c:24254 0x9a1aa3 cp_parser_type_specifier ../../gcc/cp/parser.c:17762 0x9b6b53 cp_parser_type_specifier_seq ../../gcc/cp/parser.c:22439 0x9afa94 cp_parser_type_id_1 ../../gcc/cp/parser.c:22256 0x9b2603 cp_parser_template_type_arg ../../gcc/cp/parser.c:22347 0x9b6ccf cp_parser_template_argument ../../gcc/cp/parser.c:17235 0x9b6ccf cp_parser_template_argument_list ../../gcc/cp/parser.c:17146 0x9b6ccf cp_parser_enclosed_template_argument_list ../../gcc/cp/parser.c:29832 0x9b8cd0 cp_parser_check_for_invalid_template_id ../../gcc/cp/parser.c:3202 0x99ff18 cp_parser_check_for_invalid_template_id ../../gcc/cp/parser.c:3181 0x99ff18 cp_parser_class_head ../../gcc/cp/parser.c:24437 0x99ff18 cp_parser_class_specifier_1 ../../gcc/cp/parser.c:23880 0x9a1aa3 cp_parser_class_specifier ../../gcc/cp/parser.c:24254 0x9a1aa3 cp_parser_type_specifier ../../gcc/cp/parser.c:17762 0x9a2a02 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:14410 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.