Commit 0426c4ca by Scott Brumbaugh Committed by Ian Lance Taylor

re PR c++/4100 ([parser] friend qualifier accepted in definition of nested class)

	PR c++/4100
	* parser.c (cp_parser_decl_specifier_seq): Add check for a friend
	decl-specifier occurring along with a class definition.

From-SVN: r75726
parent 8064d930
2004-01-12 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/4100
* parser.c (cp_parser_decl_specifier_seq): Add check for a friend
decl-specifier occurring along with a class definition.
2004-01-12 Ian Lance Taylor <ian@wasabisystems.com> 2004-01-12 Ian Lance Taylor <ian@wasabisystems.com>
* parser.c (cp_parser_decl_specifier_seq): Add parenthetical * parser.c (cp_parser_decl_specifier_seq): Add parenthetical
......
...@@ -6726,6 +6726,10 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -6726,6 +6726,10 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
flags |= CP_PARSER_FLAGS_OPTIONAL; flags |= CP_PARSER_FLAGS_OPTIONAL;
} }
/* Don't allow a friend specifier with a class definition. */
if (friend_p && (*declares_class_or_enum & 2))
error ("class definition may not be declared a friend");
/* We have built up the DECL_SPECS in reverse order. Return them in /* We have built up the DECL_SPECS in reverse order. Return them in
the correct order. */ the correct order. */
return nreverse (decl_specs); return nreverse (decl_specs);
......
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