This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

friends from outer space


We currently reject this code; here is a patch.

Martin

1998-11-07  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* decl.c (grokdeclarator): Allow namespace-scoped members if they
	are friends.

--- /dev/null	Mon Jul 18 01:46:18 1994
+++ g++.ns/friend1.C	Sat Nov  7 11:48:12 1998
@@ -0,0 +1,8 @@
+// Build don't link:
+namespace A{
+  void f(int);
+}
+
+class X{
+  friend void A::f(int);
+};
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.254
diff -u -r1.254 decl.c
--- decl.c	1998/11/06 16:50:42	1.254
+++ decl.c	1998/11/07 10:42:45
@@ -10488,7 +10491,7 @@
 	       are error_mark_node, for example.  */
 	    decl = NULL_TREE;
 	  }
-	else if (in_namespace)
+	else if (in_namespace && !friendp)
 	  {
 	    /* Something like struct S { int N::j; };  */
 	    cp_error ("invalid use of `::'");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]