The following invalid code snippet triggers an ICE since GCC 3.0:
====================================================
struct A
{
A();
void* operator new(__SIZE_TYPE__, int = 0);
template<int> void operator delete(void*, int);
};
A* p = new A;
====================================================
gimplification failed:
<<< Unknown tree: template_decl >>>
<template_decl 0x40230138 operator delete
type <function_type 0x401aebc8
type <void_type 0x401a64e0 void type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x401a64e0
pointer_to_this <pointer_type 0x401a6548>>
type_6 QI
size <integer_cst 0x4018f6ac constant 8>
unit size <integer_cst 0x4018f6c8 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x401aebc8
arg-types <tree_list 0x401aaa2c value <pointer_type 0x401a6548>
chain <tree_list 0x401aaa48 value <integer_type 0x4019d2d8 int>
chain <tree_list 0x401aa118 value <void_type 0x401a64e0
void>>>>
pointer_to_this <pointer_type 0x402304e0>>
used ignored decl_1 VOID file bug.cc line 5 col 48
align 1 context <record_type 0x40227c98 A>
arguments <tree_list 0x4022d658 purpose <integer_cst 0x4018f6c8 1>
value <tree_vec 0x4022d63c type <template_decl 0x40230138 operator
delete>
elt 0 <tree_list 0x4022d620>>>
result <function_decl 0x40224af0 operator delete type <function_type
0x401aebc8>
public external no-static-chain decl_3 QI file bug.cc line 5 col 48
align 8 context <record_type 0x40227c98 A>
arguments <parm_decl 0x401968c0 D.1661 type <pointer_type 0x401a6548>
unsigned SI file bug.cc line 5 col 48
size <integer_cst 0x4018f834 constant 32>
unit size <integer_cst 0x4018f620 constant 4>
align 32 chain <parm_decl 0x40196910 D.1662>>
template-info 0x4022d6c8>
>
bug.cc: In function 'void __static_initialization_and_destruction_0(int, int)':
bug.cc:8: internal compiler error: gimplification failed
Please submit a full bug report, [etc.]
GCC 2.95.3 used to generate a valid error message:
bug.cc: In function `void __static_initialization_and_destruction_0(int, int)':
bug.cc:8: no suitable operator delete for `A'
--
Summary: [4.1/4.2/4.3/4.4 regression] ICE with template delete
operator
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, monitored
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36406