http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58664
Bug ID: 58664 Summary: [c++11] ICE initializing array of incomplete type within union Product: gcc Version: unknown 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.0 (when non-static data member initializers were introduced): ===================== union U { U u[1] = { 0 }; }; ===================== bug.cc:1:7: internal compiler error: Segmentation fault union U ^ 0xaef9cf crash_signal ../../gcc/gcc/toplev.c:335 0x90292f contains_struct_check ../../gcc/gcc/tree.h:2722 0x90292f size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:1497 0xae7199 place_union_field ../../gcc/gcc/stor-layout.c:1038 0xae7199 place_field(record_layout_info_s*, tree_node*) ../../gcc/gcc/stor-layout.c:1101 0x5e8b3a layout_nonempty_base_or_field ../../gcc/gcc/cp/class.c:4020 0x5f8935 layout_class_type ../../gcc/gcc/cp/class.c:6082 0x60402c finish_struct_1(tree_node*) ../../gcc/gcc/cp/class.c:6419 0x6063b4 finish_struct(tree_node*, tree_node*) ../../gcc/gcc/cp/class.c:6713 0x635a1b cp_parser_class_specifier_1 ../../gcc/gcc/cp/parser.c:18903 0x638370 cp_parser_class_specifier ../../gcc/gcc/cp/parser.c:19111 0x638370 cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:14090 0x64d879 cp_parser_decl_specifier_seq ../../gcc/gcc/cp/parser.c:11337 0x651929 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:10927 0x653950 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10876 0x65c97e cp_parser_declaration ../../gcc/gcc/cp/parser.c:10773 0x65b6ea cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10659 0x65cfb6 cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:3939 0x65cfb6 c_parse_file() ../../gcc/gcc/cp/parser.c:28911 0x770ac3 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1046 Please submit a full bug report, [etc.]