https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122469
Bug ID: 122469
Summary: internal compiler error: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
cxx_safe_arg_type_equiv_p, at cp/typeck.cc:1368
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qingren2hxb at gmail dot com
Target Milestone: ---
Created attachment 62657
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62657&action=edit
bug report by using -freport-bug
=====================================================
$g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
=====================================================
struct __my_st_t {
};
void _test_fn(struct __my_st_t *y, struct __my_st_t *xt)
{
}
int main() {
static struct __my_st_t xtab[] = {};
for(int i=0,j=sizeof(xtab)/sizeof(*xtab);i<j;i++)
for(int k=i+!i;k<j;k++)
volatile void (*ptr)(struct __my_st_t*,struct __my_st_t*)=(void
(*)(void,void*))&_test_fn,
}
=====================================================
$g++ x.C
x.C: In function 'int main()':
x.C:12:78: error: invalid use of type 'void' in parameter declaration
12 | volatile void (*ptr)(struct __my_st_t*,struct
__my_st_t*)=(void (*)(void,void*))&_test_fn,
|
^~~~
x.C:12:91: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in cxx_safe_arg_type_equiv_p, at cp/typeck.cc:1368
12 | volatile void (*ptr)(struct __my_st_t*,struct
__my_st_t*)=(void (*)(void,void*))&_test_fn,
|
^~~~~~~~
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x2edbb4a tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/workspace/gcc/gcc/tree.cc:9164
0xec3240 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/workspace/gcc/gcc/tree.h:3847
0x16ccf55 cxx_safe_arg_type_equiv_p
/workspace/gcc/gcc/cp/typeck.cc:1368
0x16cd78c cxx_safe_function_type_cast_p
/workspace/gcc/gcc/cp/typeck.cc:1410
0x1702a59 build_reinterpret_cast_1
/workspace/gcc/gcc/cp/typeck.cc:8993
0x1705748 cp_build_c_cast(unsigned long, tree_node*, tree_node*, int)
/workspace/gcc/gcc/cp/typeck.cc:9405
0x1704d2f build_c_cast(unsigned long, tree_node*, cp_expr)
/workspace/gcc/gcc/cp/typeck.cc:9305
0x13bcbbe cp_parser_cast_expression
/workspace/gcc/gcc/cp/parser.cc:10638
0x13bce20 cp_parser_binary_expression
/workspace/gcc/gcc/cp/parser.cc:10751
0x13bece9 cp_parser_assignment_expression
/workspace/gcc/gcc/cp/parser.cc:11096
0x13bffbf cp_parser_constant_expression
/workspace/gcc/gcc/cp/parser.cc:11402
0x13ffd63 cp_parser_initializer_clause
/workspace/gcc/gcc/cp/parser.cc:26865
0x13ff9b7 cp_parser_initializer
/workspace/gcc/gcc/cp/parser.cc:26804
0x13f5c87 cp_parser_init_declarator
/workspace/gcc/gcc/cp/parser.cc:24228
0x13d7ba7 cp_parser_simple_declaration
/workspace/gcc/gcc/cp/parser.cc:16528
0x13d731e cp_parser_block_declaration
/workspace/gcc/gcc/cp/parser.cc:16347
0x13d349b cp_parser_declaration_statement
/workspace/gcc/gcc/cp/parser.cc:15444
0x13c977c cp_parser_statement
/workspace/gcc/gcc/cp/parser.cc:13285
0x13d3a8d cp_parser_already_scoped_statement
/workspace/gcc/gcc/cp/parser.cc:15541
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.