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

            Bug ID: 79360
           Summary: [5.4/6/7 Regression] ICE with NSDMI and enum in union
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

Compiling the following valid code results in a crash

=======================
union U
{
  enum E { e };
};

struct A
{
  U u{};
};
=======================

bug3.cc:8:7: internal compiler error: in process_init_constructor_union, at
cp/typeck2.c:1562
   U u{};
       ^
0x6f222d process_init_constructor_union
        ../../gcc/gcc/cp/typeck2.c:1561
0x6f222d process_init_constructor
        ../../gcc/gcc/cp/typeck2.c:1616
0x6f222d digest_init_r
        ../../gcc/gcc/cp/typeck2.c:1125
0x6f4230 digest_init_flags(tree_node*, tree_node*, int, int)
        ../../gcc/gcc/cp/typeck2.c:1170
0x6f4230 digest_nsdmi_init(tree_node*, tree_node*)
        ../../gcc/gcc/cp/typeck2.c:1186
0x76539f cp_parser_late_parse_one_default_arg
        ../../gcc/gcc/cp/parser.c:27167
0x74f693 cp_parser_late_parsing_nsdmi
        ../../gcc/gcc/cp/parser.c:27200
0x74f693 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:22265
0x750a59 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:22318
0x750a59 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:16409
0x751827 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:13326
0x778901 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:12647
0x779845 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12592
0x752527 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12489
0x782c8b cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12365
0x782f6a cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4369
0x782f6a c_parse_file()
        ../../gcc/gcc/cp/parser.c:38356
0x8df643 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1107
Please submit a full bug report, [etc.]

This bug appears in GCC 5.4.0, 6.x, 7.0, but not in GCC 5.3.0 or before.

Reply via email to