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