https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124521
Bug ID: 124521
Summary: Segmentation fault on invalid template default
argument with enum initializer
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: suyuchang at whu dot edu.cn
Target Milestone: ---
Code:
template <typename = enum { a(b < ~a
Command:
g++ -c test.cpp
test.cpp:1:36: internal compiler error: Segmentation fault
1 | template <typename = enum { a(b < ~a
| ^
0x2cb8d8e internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x16f2b26 crash_signal
../../gcc-trunk/gcc/toplev.cc:325
0x7fd5681b951f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xcd4336 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3934
0xcd4336 type_promotes_to(tree_node*)
../../gcc-trunk/gcc/cp/cvt.cc:2052
0xc39ca0 add_builtin_candidates
../../gcc-trunk/gcc/cp/call.cc:3574
0xc3a483 add_operator_candidates
../../gcc-trunk/gcc/cp/call.cc:7254
0xc44e85 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
../../gcc-trunk/gcc/cp/call.cc:7413
0xf8225d build_x_unary_op(unsigned long, tree_code, cp_expr, tree_node*, int)
../../gcc-trunk/gcc/cp/typeck.cc:7253
0xe3b89e cp_parser_unary_expression
../../gcc-trunk/gcc/cp/parser.cc:10572
0xe1cac8 cp_parser_cast_expression
../../gcc-trunk/gcc/cp/parser.cc:11540
0xe1dc9e cp_parser_binary_expression
../../gcc-trunk/gcc/cp/parser.cc:11643
0xe1ef71 cp_parser_assignment_expression
../../gcc-trunk/gcc/cp/parser.cc:11996
0xe57dc6 cp_parser_template_argument
../../gcc-trunk/gcc/cp/parser.cc:22002
0xe57dc6 cp_parser_template_argument_list
../../gcc-trunk/gcc/cp/parser.cc:21693
0xe57dc6 cp_parser_enclosed_template_argument_list
../../gcc-trunk/gcc/cp/parser.cc:36805
0xe597ac cp_parser_template_id
../../gcc-trunk/gcc/cp/parser.cc:21203
0xe5b12d cp_parser_class_name
../../gcc-trunk/gcc/cp/parser.cc:29507
0xe42626 cp_parser_qualifying_entity
../../gcc-trunk/gcc/cp/parser.cc:8324
0xe42626 cp_parser_nested_name_specifier_opt
../../gcc-trunk/gcc/cp/parser.cc:7992
/home/syc/gcc-16.0/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -quiet -dumpdir a-
-dumpbase test.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -o
/tmp/ccVw0w90.s
This only occurs in GCC-trunk.
The test case was generated by a fuzzer.