Bug 95925 - ICE in xref_basetypes, at cp/decl.c:15169
Summary: ICE in xref_basetypes, at cp/decl.c:15169
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.0
: P5 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2020-06-27 02:07 UTC by Haoxin Tu
Modified: 2021-08-08 09:21 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Haoxin Tu 2020-06-27 02:07:32 UTC
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.