/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Aug 2007 09:05:17 +0000 (09:05 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Aug 2007 09:05:17 +0000 (09:05 +0000)
2007-08-16  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-16  Paolo Carlini  <pcarlini@suse.de>

PR c++/31132
* g++.dg/template/crash69.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127535 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash69.C [new file with mode: 0644]

index 6a7a4a4..6e7bd96 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-16  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31132
+       * pt.c (tsubst_friend_function): When check_classfn
+       returns error_mark_node likewise return it.
+
 2007-08-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/32992
index f414bc3..68cd9a5 100644 (file)
@@ -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;
        }
     }
index 5126a69..14e58c9 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-16  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31132
+       * g++.dg/template/crash69.C: New.
+
 2007-08-15  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * 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 (file)
index 0000000..957f1e1
--- /dev/null
@@ -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" }
+};