Commit 0007ff03 by Paolo Carlini Committed by Paolo Carlini

re PR c++/58650 ([c++11] ICE with invalid friend declaration)

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

From-SVN: r218801
parent e0d475db
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.
2014-12-15 Jan Hubicka <hubicka@ucw.cz>
* decl2.c (decl_needed_p): When not optimizing, do not consider external
......
......@@ -21069,7 +21069,10 @@ cp_parser_member_declaration (cp_parser* parser)
if (decl)
{
/* Add DECL to the list of members. */
if (!friend_p)
if (!friend_p
/* Explicitly include, eg, NSDMIs, for better error
recovery (c++/58650). */
|| !DECL_DECLARES_FUNCTION_P (decl))
finish_member_declaration (decl);
if (TREE_CODE (decl) == FUNCTION_DECL)
......
2014-12-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58650
* g++.dg/parse/friend12.C: New.
2014-12-16 Oleg Endo <olegendo@gcc.gnu.org>
PR target/54089
......
// PR c++/58650
struct A
{
friend int i = 0; // { dg-error "cannot be declared friend" }
// { dg-error "non-static data member" "" { target { ! c++11 } } 5 }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment