https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122471
Bug ID: 122471
Summary: ICE: canonical types differ for identical types
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 62658
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62658&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)
(--enable-checking)
====================================================
struct A {
int x =;
void operator+(void* i=);
A(void*);
};
A::A(void* i=) {
}
void A::operator+(void*) {
}
====================================================
# g++ x.C
x.C:3:10: error: 'void A::operator+(void*)' cannot have default arguments
3 | void operator+(void* i=);
| ^~~~~~~~
x.C:2:12: error: expected primary-expression at end of input
2 | int x =;
| ^
x.C:7:14: error: expected primary-expression before ')' token
7 | A::A(void* i=) {
| ^
x.C:7:14: internal compiler error: canonical types differ for identical types
'void (A::)(void*)' and 'void (A::)(void*)'
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x16d1851 comptypes(tree_node*, tree_node*, int)
/workspace/gcc/gcc/cp/typeck.cc:1738
0x10c8069 duplicate_decls(tree_node*, tree_node*, bool, bool)
/workspace/gcc/gcc/cp/decl.cc:2688
0x1114789 grokfndecl
/workspace/gcc/gcc/cp/decl.cc:11600
0x112ca7b grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
/workspace/gcc/gcc/cp/decl.cc:15670
0x1148618 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
/workspace/gcc/gcc/cp/decl.cc:18824
0x141aff0 cp_parser_function_definition_from_specifiers_and_declarator
/workspace/gcc/gcc/cp/parser.cc:33527
0x13f4dad cp_parser_init_declarator
/workspace/gcc/gcc/cp/parser.cc:24009
0x13d7ba7 cp_parser_simple_declaration
/workspace/gcc/gcc/cp/parser.cc:16528
0x13d731e cp_parser_block_declaration
/workspace/gcc/gcc/cp/parser.cc:16347
0x13d6aa3 cp_parser_declaration
/workspace/gcc/gcc/cp/parser.cc:16201
0x13d6c21 cp_parser_toplevel_declaration
/workspace/gcc/gcc/cp/parser.cc:16222
0x13a6130 cp_parser_translation_unit
/workspace/gcc/gcc/cp/parser.cc:5469
0x1492cf4 c_parse_file()
/workspace/gcc/gcc/cp/parser.cc:53961
0x184702a c_common_parse_file()
/workspace/gcc/gcc/c-family/c-opts.cc:1379
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.