https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122882
Bug ID: 122882
Summary: ICE in grokdeclarator, at cp/decl.cc
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 522024330006 at smail dot nju.edu.cn
Target Milestone: ---
Trying to use typeof to get the type of the destructor,the compiler went crash.
Compiler Explorer: https://godbolt.org/z/jhPWvGoj7
Program:
```c
struct MyType {
virtual ~MyType() {}
};
__typeof__(MyType::~MyType) *__real_MyT_del;
```
The full traceback:
cases/26272.fuzz:30:30: internal compiler error: in grokdeclarator, at
cp/decl.cc:14436
30 | __typeof__(MyType::~MyType) *__real_MyT_del;
| ^~~~~~~~~~~~~~
0x5da1dc8 internal_error(char const*, ...)
/workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:517
0x5d3f858 fancy_abort(char const*, int, char const*)
/workspace/install/gcc/src/gcc/gcc/diagnostic.cc:1749
0x10dda92 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
/workspace/install/gcc/src/gcc/gcc/cp/decl.cc:14436
0x109b1b8 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
/workspace/install/gcc/src/gcc/gcc/cp/decl.cc:5970
0x13b6c4f cp_parser_init_declarator
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:24151
0x13989a6 cp_parser_simple_declaration
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:16532
0x13980ba cp_parser_block_declaration
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:16351
0x139782b cp_parser_declaration
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:16204
0x139799d cp_parser_toplevel_declaration
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:16225
0x1366c19 cp_parser_translation_unit
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:5469
0x1457934 c_parse_file()
/workspace/install/gcc/src/gcc/gcc/cp/parser.cc:54014
0x18196a0 c_common_parse_file()
/workspace/install/gcc/src/gcc/gcc/c-family/c-opts.cc:1381
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
The gcc version I used is:
Using built-in specs.
COLLECT_GCC=/workspace/install/gcc/install_15.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/workspace/install/gcc/install_15.2.0/libexec/gcc/x86_64-pc-linux-gnu/15.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/install/gcc/src/gcc/configure --enable-coverage
--enable-checking --disable-multilib --disable-shared --disable-bootstrap
--enable-languages=c,c++ --prefix=/workspace/install/gcc/install_15.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (GCC)