Blame SOURCES/gcc32-c++-friend-templ-member.patch

4ac4fd
2004-08-06  Alexandre Oliva  <aoliva@redhat.com>
4ac4fd
4ac4fd
	* parse.y (structsp): Skip typename_type obtained from a
4ac4fd
	class_head_decl, use the actual type.
4ac4fd
4ac4fd
2004-08-09  Alexandre Oliva  <aoliva@redhat.com>
4ac4fd
4ac4fd
	* g++.old-deja/g++.pt/crash43.C: Don't require error for legal
4ac4fd
	construct.
4ac4fd
	* g++.dg/template/friend0.C: New test.
4ac4fd
4ac4fd
--- gcc/cp/parse.y.jj
4ac4fd
+++ gcc/cp/parse.y
4ac4fd
@@ -2371,6 +2374,13 @@ structsp:
4ac4fd
 	| class_head_decl
4ac4fd
 		{
4ac4fd
 		  $$.t = TREE_TYPE ($1.t);
4ac4fd
+		  /* class_head_decl always starts with an aggr, so
4ac4fd
+		     get rid of any implicit typename warnings we
4ac4fd
+		     might get from it.  We can't remove it before
4ac4fd
+		     this point because this is where we get from the
4ac4fd
+		     decl to the type.  */
4ac4fd
+		  if (IMPLICIT_TYPENAME_P ($$.t))
4ac4fd
+		    $$.t = TREE_TYPE ($$.t);
4ac4fd
 		  $$.new_type_flag = $1.new_type_flag;
4ac4fd
 		  check_class_key (current_aggr, $$.t);
4ac4fd
 		}
4ac4fd
--- gcc/testsuite/g++.old-deja/g++.pt/crash43.C 27 Nov 2002 01:03:42 -0000 1.1
4ac4fd
+++ gcc/testsuite/g++.old-deja/g++.pt/crash43.C 9 Aug 2004 17:20:46 -0000
4ac4fd
@@ -7,7 +7,7 @@ struct S {
4ac4fd
   struct Y {};
4ac4fd
 
4ac4fd
   template <int U>
4ac4fd
-  friend struct S<U>::X; // ERROR - typename as friend
4ac4fd
+  friend struct S<U>::X; // gets bogus error - XFAIL *-*-*
4ac4fd
 
4ac4fd
   template <int U>
4ac4fd
   friend typename S<U>::Y; // ERROR - typename as friend
4ac4fd
@@ -15,7 +15,7 @@ struct S {
4ac4fd
 
4ac4fd
 struct T {
4ac4fd
   template <int T>
4ac4fd
-  friend struct S<T>::X; // ERROR - typename as friend
4ac4fd
+  friend struct S<T>::X;
4ac4fd
 };
4ac4fd
 
4ac4fd
 struct U {
4ac4fd
--- gcc/testsuite/g++.dg/template/friend0.C.jj	2004-08-12 14:03:21.001079817 +0200
4ac4fd
+++ gcc/testsuite/g++.dg/template/friend0.C	2004-08-12 14:03:15.734996391 +0200
4ac4fd
@@ -0,0 +1,10 @@
4ac4fd
+// http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=129350
4ac4fd
+// { dg-do compile }
4ac4fd
+
4ac4fd
+template<class T> struct A {
4ac4fd
+        struct B { };
4ac4fd
+};
4ac4fd
+
4ac4fd
+class C {
4ac4fd
+        template<class T> friend struct A<T>::B;
4ac4fd
+};