This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
friends from outer space
- To: egcs-patches at cygnus dot com
- Subject: friends from outer space
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 7 Nov 1998 12:37:23 +0100
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 `::'");