aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Brumbaugh <scottb.lists@verizon.net>2004-01-12 16:14:41 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2004-01-12 16:14:41 +0000
commit0426c4ca869f62525e807d8fc1bff9a983780308 (patch)
tree463b8787bb575c71cc03d101c85cdc09526be242
parent8064d930e80f245b379f51072b4b85746b8e4ccf (diff)
downloadgcc-0426c4ca869f62525e807d8fc1bff9a983780308.zip
gcc-0426c4ca869f62525e807d8fc1bff9a983780308.tar.gz
gcc-0426c4ca869f62525e807d8fc1bff9a983780308.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a8b4781..48d831e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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>
* parser.c (cp_parser_decl_specifier_seq): Add parenthetical
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8660126..fe3a3de 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6726,6 +6726,10 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
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
the correct order. */
return nreverse (decl_specs);