https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101887

            Bug ID: 101887
           Summary: [9/10/11/12 Regression] ICE with invalid declaration
                    of 'operator delete'
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 4.9.0:

================================================
struct A
{
  A();
  auto operator delete(void*, __SIZE_TYPE__);
};

void foo()
{
  new A;
}
================================================

bug.cc:4:3: error: non-static data member declared with placeholder 'auto'
    4 |   auto operator delete(void*, __SIZE_TYPE__);
      |   ^~~~
bug.cc: In function 'void foo()':
bug.cc:9:7: internal compiler error: tree check: expected function_type or
method_type, have error_mark in usual_deallocation_fn_p, at cp/call.c:6935
    9 |   new A;
      |       ^
0x85a540 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:8686
0x6544a6 tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
        ../../gcc/gcc/tree.h:3392
0x6544a6 usual_deallocation_fn_p
        ../../gcc/gcc/cp/call.c:6935
0x9229e0 build_op_delete_call(tree_code, tree_node*, tree_node*, bool,
tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/call.c:6926
0xa0c128 build_new_1
        ../../gcc/gcc/cp/init.c:3539
0xa0cf98 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
        ../../gcc/gcc/cp/init.c:3826
0xabf7d2 cp_parser_new_expression
        ../../gcc/gcc/cp/parser.c:9157
0xabfdff cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:8745
0xa91a2a cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:9893
0xa9233c cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:10197
0xa938b2 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:10367
0xa96f58 cp_parser_expression_statement
        ../../gcc/gcc/cp/parser.c:12531
0xaa2dff cp_parser_statement
        ../../gcc/gcc/cp/parser.c:12327
0xaa3e9d cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:12679
0xaa3f78 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:12628
0xac35c0 cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:24762
0xac35c0 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:24813
0xac428a cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:30898
0xac56c4 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:30814
0xac56c4 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:22318
Please submit a full bug report, [etc.]

Reply via email to