public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58650] New: [c++11] ICE with invalid friend declaration
@ 2013-10-06 21:10 reichelt at gcc dot gnu.org
  2014-12-16 23:29 ` [Bug c++/58650] " paolo at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-06 21:10 UTC (permalink / raw)
  To: gcc-bugs

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.]


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/58650] [c++11] ICE with invalid friend declaration
  2013-10-06 21:10 [Bug c++/58650] New: [c++11] ICE with invalid friend declaration reichelt at gcc dot gnu.org
@ 2014-12-16 23:29 ` paolo at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-12-16 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Dec 16 23:28:31 2014
New Revision: 218801

URL: https://gcc.gnu.org/viewcvs?rev=218801&root=gcc&view=rev
Log:
/cp
2014-12-16  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58650
    * parser.c (cp_parser_member_declaration): Fix error recovery for
    initialized non-static data member declared friend.

/testsuite
2014-12-16  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58650
    * g++.dg/parse/friend12.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/parse/friend12.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-16 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-06 21:10 [Bug c++/58650] New: [c++11] ICE with invalid friend declaration reichelt at gcc dot gnu.org
2014-12-16 23:29 ` [Bug c++/58650] " paolo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).