This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Handle OBJ_TYPE_REF in dump_expr (PR c++/34275)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>, Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Nov 2007 04:57:59 -0500
- Subject: [C++ PATCH] Handle OBJ_TYPE_REF in dump_expr (PR c++/34275)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
OBJ_TYPE_REF isn't handled in dump_expr (well, it is, but only
inside of CALL_EXPR).
Ok for trunk?
2007-11-29 Jakub Jelinek <jakub@redhat.com>
PR c++/34275
* error.c (dump_expr): Handle OBJ_TYPE_REF.
* g++.dg/other/error20.C: New test.
--- gcc/cp/error.c.jj 2007-11-02 19:02:46.000000000 +0100
+++ gcc/cp/error.c 2007-11-29 10:46:30.000000000 +0100
@@ -2056,6 +2056,10 @@ dump_expr (tree t, int flags)
pp_expression (cxx_pp, t);
break;
+ case OBJ_TYPE_REF:
+ dump_expr (resolve_virtual_fun_from_obj_type_ref (t), flags);
+ break;
+
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
--- gcc/testsuite/g++.dg/other/error20.C.jj 2007-11-29 10:52:29.000000000 +0100
+++ gcc/testsuite/g++.dg/other/error20.C 2007-11-29 10:53:23.000000000 +0100
@@ -0,0 +1,12 @@
+// PR c++/34275
+// { dg-do compile }
+
+struct A
+{ // { dg-error "candidates" }
+ virtual A foo ();
+};
+
+void bar (A& a)
+{
+ a.foo () = 0; // { dg-error "A::foo\\(\\) = 0" }
+}
Jakub