gcc/gcc41-pr34275.patch
Jakub Jelinek 6d24351ab8 4.1.2-35
2007-12-02 19:05:44 +00:00

36 lines
935 B
Diff

2007-11-30 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 (revision 130532)
+++ gcc/cp/error.c (revision 130533)
@@ -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 (revision 0)
+++ gcc/testsuite/g++.dg/other/error20.C (revision 130533)
@@ -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" }
+}