This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 31132
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 15 Aug 2007 19:35:40 +0200
- Subject: [C++ Patch] PR 31132
Hi,
I'm tempted to consider this obvious, I'm just reverting a tiny bit of
my recent fix for 27211.
Tested x86_64-linux, Ok for mainline?
Paolo.
///////////////
/cp
2007-08-15 Paolo Carlini <pcarlini@suse.de>
PR c++/31132
* pt.c (tsubst_friend_function): When check_classfn
returns error_mark_node likewise return it.
/testsuite
2007-08-15 Paolo Carlini <pcarlini@suse.de>
PR c++/31132
* g++.dg/template/crash69.C: New.
Index: testsuite/g++.dg/template/crash69.C
===================================================================
*** testsuite/g++.dg/template/crash69.C (revision 0)
--- testsuite/g++.dg/template/crash69.C (revision 0)
***************
*** 0 ****
--- 1,12 ----
+ // PR c++/31132
+
+ template<typename T> class A
+ {
+ static int i; // { dg-error "is private" }
+ friend int T::foo(); // { dg-error "does not match" }
+ };
+
+ struct B
+ {
+ void foo() { A<B>::i; } // { dg-error "within|candidate" }
+ };
Index: cp/pt.c
===================================================================
*** cp/pt.c (revision 127509)
--- cp/pt.c (working copy)
*************** tsubst_friend_function (tree decl, tree
*** 6289,6295 ****
tree fn = check_classfn (context,
new_friend, NULL_TREE);
! if (fn && fn != error_mark_node)
new_friend = fn;
}
}
--- 6289,6295 ----
tree fn = check_classfn (context,
new_friend, NULL_TREE);
! if (fn)
new_friend = fn;
}
}