http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58611

            Bug ID: 58611
           Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid
                    constexpr constructor used in array initialization
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++11") triggers an ICE
since GCC 4.7.3:

=============================
struct A
{
  int i;
  constexpr A() {}
};

struct B
{
  A a;
};

constexpr B b[] = { {} };
=============================

bug.cc: In constructor 'constexpr A::A()':
bug.cc:4:18: error: uninitialized member 'A::i' in 'constexpr' constructor
   constexpr A() {}
                  ^
bug.cc: At global scope:
bug.cc:12:24: internal compiler error: in reshape_init_r, at cp/decl.c:5434
 constexpr B b[] = { {} };
                        ^
0x5564f9 reshape_init_r
        ../../gcc/gcc/cp/decl.c:5434
0x556812 reshape_init_array_1
        ../../gcc/gcc/cp/decl.c:5102
0x5558b9 reshape_init(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:5489
0x6bdeb8 finish_compound_literal(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/semantics.c:2481
0x557ccb check_initializer
        ../../gcc/gcc/cp/decl.c:5707
0x56a2ec cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6347
0x65119f cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16568
0x6518bf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x653740 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65c76e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65b4da cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65cda6 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65cda6 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28900
0x7707e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

Reply via email to