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

            Bug ID: 87425
           Summary: [9 Regression] ICE with virtual assignment operator
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, mpolacek at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-std=c++2a") triggers an ICE
on trunk:

=================================
struct A
{
  virtual A& operator= (int);
};

struct B
{
  A a;
  B() { a = 0; }
};
=================================

bug.cc: In constructor 'B::B()':
bug.cc:9:14: internal compiler error: Segmentation fault
9 |   B() { a = 0; }
  |              ^
0xed7eef crash_signal
        ../../gcc/gcc/toplev.c:325
0x8760fc tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/gcc/tree.h:3112
0x8760fc cxx_eval_constant_expression
        ../../gcc/gcc/cp/constexpr.c:4821
0x8791be cxx_eval_outermost_constant_expr
        ../../gcc/gcc/cp/constexpr.c:5018
0x87c6fc maybe_constant_init_1
        ../../gcc/gcc/cp/constexpr.c:5366
0x8914f0 cp_get_fndecl_from_callee(tree_node*, bool)
        ../../gcc/gcc/cp/cvt.c:967
0x8915fb maybe_warn_nodiscard
        ../../gcc/gcc/cp/cvt.c:1016
0x891ea7 convert_to_void(tree_node*, impl_conv_void, int)
        ../../gcc/gcc/cp/cvt.c:1398
0x9c15a0 finish_expr_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:686
0x93e977 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:10963
0x93fe98 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:11302
0x93ff7f cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:11256
0x956100 cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:21930
0x956100 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:21967
0x956970 cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:26982
0x9585ec cp_parser_late_parsing_for_member
        ../../gcc/gcc/cp/parser.c:27862
0x94b1ff cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:22906
0x94c1eb cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:22932
0x94c1eb cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:16920
0x958d19 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:13757
Please submit a full bug report, [etc.]

This seems to be related to PR87398.

Reply via email to