]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/4100 ([parser] friend qualifier accepted in definition of nested class)
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 12 Jan 2004 16:15:19 +0000 (16:15 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 12 Jan 2004 16:15:19 +0000 (16:15 +0000)
PR c++/4100
* g++.dg/parse/friend4.C: New test.
* g++.old-deja/g++.pt/niklas01a.C: Mark an error where a class
definition is called a friend.

From-SVN: r75727

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/friend4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C

index 92da799eefb30c96f59ce999b9280e5d7b1a6879..4c1aae0711d2540f46780176a665ba45a0d50da6 100644 (file)
@@ -1,3 +1,14 @@
+2004-01-12  Ian Lance Taylor  <ian@wasabisystems.com>
+
+       PR c++/4100
+       * g++.dg/parse/friend4.C: New test.
+
+2004-01-12  Scott Brumbaugh  <scottb.lists@verizon.net>
+
+       PR c++/4100
+       * g++.old-deja/g++.pt/niklas01a.C: Mark an error where a class
+       definition is called a friend.
+
 2004-01-11  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.dg/tls/diag-3.c: Tweak dg-error regexp.
diff --git a/gcc/testsuite/g++.dg/parse/friend4.C b/gcc/testsuite/g++.dg/parse/friend4.C
new file mode 100644 (file)
index 0000000..5eca512
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+
+// PR c++/4100
+// You can't use friend when defining a class.
+
+class A {
+  friend class B { };  // { dg-error "friend" }
+};
index 58c59d2a888b6181100adf51227a4c41833cc8e6..42a21fcb0728d7e24326f8013af1038a962d6c08 100644 (file)
@@ -3,6 +3,6 @@
 struct A { // { dg-error "" } forward declaration
   friend struct B : A {                // { dg-error "" } 
     int x;
-  };
+  };   // { dg-error "" } class definition cannot be a friend
   int y;
 };