https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117084
Bug ID: 117084 Summary: ICE: in coerce_delete_type, at cp/decl2.cc:2122 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* The compiler produces an internal error during coerce_delete_type when compiling the provided code with the specified options. The issue can also be reproduced on Compiler Explorer. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241009/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241009 --enable-languages=c,c++ --disable-multilib --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20241009 (experimental) (GCC) ******************************************************************************* Program: # cat bugreport_0_2.cpp struct A { A (); void *operator new (__SIZE_TYPE__, int = 0); template <typename T> void operator delete (void *, T); }; template <> void A::operator delete<int> (void *, int); A *p = new A; ******************************************************************************* Command Lines: # g++ bugreport_0_2.cpp -Os -ffast-math -fno-trapping-math -fmerge-all-constants -fira-loop-pressure bugreport_0_2.cpp:8:54: internal compiler error: in coerce_delete_type, at cp/decl2.cc:2122 8 | template <> void A::operator delete<int> (void *, int); | ^ 0x2920dae internal_error(char const*, ...) ../../gcc/gcc/diagnostic-global-context.cc:517 0xabdf35 fancy_abort(char const*, int, char const*) ../../gcc/gcc/diagnostic.cc:1617 0xbbe3af coerce_delete_type(tree_node*, unsigned int) ../../gcc/gcc/cp/decl2.cc:2122 0xb8aa7c grok_op_properties(tree_node*, bool) ../../gcc/gcc/cp/decl.cc:16196 0xb9a862 grokfndecl ../../gcc/gcc/cp/decl.cc:11065 0xba15ec grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**) ../../gcc/gcc/cp/decl.cc:15278 0xba652c start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc/gcc/cp/decl.cc:5950 0xcc3f07 cp_parser_init_declarator ../../gcc/gcc/cp/parser.cc:23776 0xccc67c cp_parser_single_declaration ../../gcc/gcc/cp/parser.cc:33570 0xccd480 cp_parser_explicit_specialization ../../gcc/gcc/cp/parser.cc:20207 0xcd69b6 cp_parser_declaration ../../gcc/gcc/cp/parser.cc:15751 0xcd72fa cp_parser_toplevel_declaration ../../gcc/gcc/cp/parser.cc:15859 0xcd72fa cp_parser_translation_unit ../../gcc/gcc/cp/parser.cc:5321 0xcd72fa c_parse_file() ../../gcc/gcc/cp/parser.cc:51995 0xe321f1 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.cc:1349 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. ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/aPnd1zrbP *******************************************************************************