https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95925
Bug ID: 95925
Summary: ICE in xref_basetypes, at cp/decl.c:15169
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 ICE.
$cat bug.cc
class a;
template <union a {
} struct a {
$g++ bug.cc
bug.cc:2:17: error: ‘union’ tag used in naming ‘class a’
2 | template <union a {
| ^
bug.cc:1:7: note: ‘class a’ was previously declared here
1 | class a;
| ^
bug.cc:2:19: error: types may not be defined in parameter types
2 | template <union a {
| ^
bug.cc:2:19: error: definition of ‘struct a’ inside template parameter list
bug.cc:3:10: internal compiler error: in xref_basetypes, at cp/decl.c:15169
3 | } struct a {
| ^
0x616b27 xref_basetypes(tree_node*, tree_node*)
../../gcc/cp/decl.c:15169
0x9a16fe cp_parser_class_head
../../gcc/cp/parser.c:24723
0x9a16fe 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
0x9bf3ef cp_parser_parameter_declaration
../../gcc/cp/parser.c:22818
0x9c03ab cp_parser_template_parameter
../../gcc/cp/parser.c:16360
0x9c03ab cp_parser_template_parameter_list
../../gcc/cp/parser.c:15951
0x9c9962 cp_parser_explicit_template_declaration
../../gcc/cp/parser.c:29373
0x9cca89 cp_parser_declaration
../../gcc/cp/parser.c:13433
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.