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

            Bug ID: 101405
           Summary: internal compiler error: in reshape_init_class, at
                    cp/decl.c:6483
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carlo at gcc dot gnu.org
  Target Milestone: ---

Invalid code.

struct A {
  int const a = 1;
  int const b = 2;
};

struct B : A {
  using A::a;
  using A::b;
  int const c = 3;
  int const d = 4;
};

int main()
{
  [[maybe_unused]] B b =
  {
      .a = 10,
      .d = 42
  };
}

Result:

prog.cc: In function 'int main()':
prog.cc:19:3: internal compiler error: in reshape_init_class, at cp/decl.c:6483
   19 |   };
      |   ^
0x5ffc9b reshape_init_class
        ../../source/gcc/cp/decl.c:6483
0x5ffc9b reshape_init_r
        ../../source/gcc/cp/decl.c:6791
0x6b19ac reshape_init(tree_node*, tree_node*, int)
        ../../source/gcc/cp/decl.c:6867
0x6b3e12 check_initializer
        ../../source/gcc/cp/decl.c:7064
0x6c7978 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../source/gcc/cp/decl.c:8101
0x7823d7 cp_parser_init_declarator
        ../../source/gcc/cp/parser.c:22258
0x760a04 cp_parser_simple_declaration
        ../../source/gcc/cp/parser.c:14801
0x76282d cp_parser_declaration_statement
        ../../source/gcc/cp/parser.c:13936
0x762ba6 cp_parser_statement
        ../../source/gcc/cp/parser.c:12066
0x763d2d cp_parser_statement_seq_opt
        ../../source/gcc/cp/parser.c:12433
0x763de0 cp_parser_compound_statement
        ../../source/gcc/cp/parser.c:12382
0x78051a cp_parser_function_body
        ../../source/gcc/cp/parser.c:24448
0x78051a cp_parser_ctor_initializer_opt_and_function_body
        ../../source/gcc/cp/parser.c:24499
0x78174a cp_parser_function_definition_after_declarator
        ../../source/gcc/cp/parser.c:30572
0x7828ac cp_parser_function_definition_from_specifiers_and_declarator
        ../../source/gcc/cp/parser.c:30488
0x7828ac cp_parser_init_declarator
        ../../source/gcc/cp/parser.c:22020
0x760a04 cp_parser_simple_declaration
        ../../source/gcc/cp/parser.c:14801
0x78b715 cp_parser_declaration
        ../../source/gcc/cp/parser.c:14498
0x78c3a6 cp_parser_toplevel_declaration
        ../../source/gcc/cp/parser.c:14527
0x78c3a6 cp_parser_translation_unit
        ../../source/gcc/cp/parser.c:4958
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Tested on https://wandbox.org/permlink/I8cRHJ2jAk9Op94a

Reply via email to