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

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