aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-11-28 10:06:16 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-11-28 10:06:16 +0000
commit5ee4cc26fbaccd529679ca56cd1086aa62bc9902 (patch)
treedfcd9beb9fd00cbc3d3b6e43ed880f60301ee1e6
parent8ce10512a9da9932822825cda0cd53d7e6b94ef3 (diff)
downloadgcc-5ee4cc26fbaccd529679ca56cd1086aa62bc9902.zip
gcc-5ee4cc26fbaccd529679ca56cd1086aa62bc9902.tar.gz
gcc-5ee4cc26fbaccd529679ca56cd1086aa62bc9902.tar.bz2
decl.c (grokdeclarator): Do type access control on friend class.
cp: * decl.c (grokdeclarator): Do type access control on friend class. testsuite: * g++.old-deja/g++.other/friend9.C: New test. From-SVN: r37814
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/friend9.C23
4 files changed, 36 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 438f29a..fa09401 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Do type access control on friend
+ class.
+
2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokfndecl): Undo COMPONENT_REF damage caused by
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 3ca4ff6..da74687 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -11305,12 +11305,15 @@ friend declaration requires class-key, i.e. `friend %#T'",
/* Only try to do this stuff if we didn't already give up. */
if (type != integer_type_node)
{
+ decl_type_access_control (TYPE_NAME (type));
+
/* A friendly class? */
if (current_class_type)
make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type));
else
cp_error ("trying to make class `%T' a friend of global scope",
type);
+
type = void_type_node;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1a46dff..66e4723 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,10 +1,14 @@
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.other/friend9.C: New test.
+
2000-11-28 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20001127-1.c: New test.
2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
- * g++.old-deja/g++.other/friend46.C: New test.
+ * g++.old-deja/g++.pt/friend46.C: New test.
2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend9.C b/gcc/testsuite/g++.old-deja/g++.other/friend9.C
new file mode 100644
index 0000000..442d989
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/friend9.C
@@ -0,0 +1,23 @@
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 Nov 2000 <nathan@codesourcery.com>
+
+// Bug 853: We reported the wrong line no for a friend access violation
+
+class F
+{
+ class Internal; // ERROR - is private
+};
+
+class C
+{
+ friend class F::Internal; // ERROR - in this context
+ public:
+ typedef enum { A, B } e;
+
+ C ();
+ ~C();
+
+ void m();
+};