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.]
The 4.7 branch is being closed, moving target milestone to 4.8.4.
Author: jason Date: Mon Jul 14 05:25:31 2014 New Revision: 212506 URL: https://gcc.gnu.org/viewcvs?rev=212506&root=gcc&view=rev Log: PR c++/58611 * decl.c (check_initializer): Don't finish_compound_literal on erroneous constexpr init. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array6.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c
Fixed on trunk.