http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58650
Bug ID: 58650 Summary: [c++11] ICE with invalid friend declaration 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.0 (when non-static data member initializers were introduced): ======================= struct A { friend int i = 0; }; ======================= bug.cc:3:18: error: 'i' is neither function nor member function; cannot be declared friend friend int i = 0; ^ bug.cc:4:1: internal compiler error: Segmentation fault }; ^ 0xaef7bf crash_signal ../../gcc/gcc/toplev.c:335 0x558397 build_this_parm(tree_node*, int) ../../gcc/gcc/cp/decl.c:7277 0x62bd7d inject_this_parameter ../../gcc/gcc/cp/parser.c:17550 0x635dc7 cp_parser_class_specifier_1 ../../gcc/gcc/cp/parser.c:19077 0x638230 cp_parser_class_specifier ../../gcc/gcc/cp/parser.c:19111 0x638230 cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:14090 0x64d739 cp_parser_decl_specifier_seq ../../gcc/gcc/cp/parser.c:11337 0x6517e9 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:10927 0x653810 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10876 0x65c83e cp_parser_declaration ../../gcc/gcc/cp/parser.c:10773 0x65b5aa cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10659 0x65ce76 cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:3939 0x65ce76 c_parse_file() ../../gcc/gcc/cp/parser.c:28911 0x7708b3 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1046 Please submit a full bug report, [etc.]