From: Paolo Carlini Date: Thu, 16 Aug 2007 09:05:17 +0000 (+0000) Subject: re PR c++/31132 (ICE on inconsistent friend declaration) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=684939cef5c8dee565d3711b720c45c5b6596b8a;p=gcc.git re PR c++/31132 (ICE on inconsistent friend declaration) /cp 2007-08-16 Paolo Carlini PR c++/31132 * pt.c (tsubst_friend_function): When check_classfn returns error_mark_node likewise return it. /testsuite 2007-08-16 Paolo Carlini PR c++/31132 * g++.dg/template/crash69.C: New. From-SVN: r127535 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a7a4a41dfd..6e7bd964f11 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-08-16 Paolo Carlini + + PR c++/31132 + * pt.c (tsubst_friend_function): When check_classfn + returns error_mark_node likewise return it. + 2007-08-15 Jakub Jelinek PR c++/32992 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f414bc3521f..68cd9a580a2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6289,7 +6289,7 @@ tsubst_friend_function (tree decl, tree args) tree fn = check_classfn (context, new_friend, NULL_TREE); - if (fn && fn != error_mark_node) + if (fn) new_friend = fn; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5126a69c5bf..14e58c9b42a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-16 Paolo Carlini + + PR c++/31132 + * g++.dg/template/crash69.C: New. + 2007-08-15 Daniel Jacobowitz * lib/target-supports.exp (check_effective_target_arm32): Use diff --git a/gcc/testsuite/g++.dg/template/crash69.C b/gcc/testsuite/g++.dg/template/crash69.C new file mode 100644 index 00000000000..957f1e19ba3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash69.C @@ -0,0 +1,12 @@ +// PR c++/31132 + +template class A +{ + static int i; // { dg-error "is private" } + friend int T::foo(); // { dg-error "does not match" } +}; + +struct B +{ + void foo() { A::i; } // { dg-error "within|candidate" } +};