re PR c++/33844 (Broken diagnostic: 'dotstar_expr/member_ref' not supported by pp_cxx...
authorJakub Jelinek <jakub@redhat.com>
Sat, 27 Oct 2007 15:55:34 +0000 (17:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 27 Oct 2007 15:55:34 +0000 (17:55 +0200)
PR c++/33844
* cxx-pretty-print.c (pp_cxx_pm_expression) <case MEMBER_REF>: Print
->* rather than .*.
* error.c (dump_expr): Handle MEMBER_REF and DOTSTAR_EXPR.

* g++.dg/other/ptrmem8.C: New test.

From-SVN: r129682

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/ptrmem8.C [new file with mode: 0644]

index be18c36c78fd4986d846cc0e5999e5085316be1b..90a010f934e3bf9b043193b388a3bb7425fbab3c 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/33844
+       * cxx-pretty-print.c (pp_cxx_pm_expression) <case MEMBER_REF>: Print
+       ->* rather than .*.
+       * error.c (dump_expr): Handle MEMBER_REF and DOTSTAR_EXPR.
+
 2007-10-27  Jason Merrill  <jason@redhat.com>
 
        PR c++/5247
index 5cbf82cc85928aed3ab19cf52dbf98b7ef0b2c7b..1de5964dd7383b16345b7d7f4ccb2a516007ac7b 100644 (file)
@@ -814,7 +814,10 @@ pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
     case MEMBER_REF:
     case DOTSTAR_EXPR:
       pp_cxx_pm_expression (pp, TREE_OPERAND (t, 0));
-      pp_cxx_dot (pp);
+      if (TREE_CODE (t) == MEMBER_REF)
+       pp_cxx_arrow (pp);
+      else
+       pp_cxx_dot (pp);
       pp_star(pp);
       pp_cxx_cast_expression (pp, TREE_OPERAND (t, 1));
       break;
index 5a54e8c9ada893d78f7f6f96fd2f81ded2de5b14..5456c85c39b6d6a72bf040a86a7ec2bec78be981 100644 (file)
@@ -2052,6 +2052,11 @@ dump_expr (tree t, int flags)
       pp_cxx_offsetof_expression (cxx_pp, t);
       break;
 
+    case MEMBER_REF:
+    case DOTSTAR_EXPR:
+      pp_multiplicative_expression (cxx_pp, t);
+      break;
+
     case DELETE_EXPR:
     case VEC_DELETE_EXPR:
       pp_cxx_delete_expression (cxx_pp, t);
index 837c35acdf9fff6238314be484a6dfdba127b915..0705dc14dc46e67dc2b07efcd50f970c9bca4edb 100644 (file)
@@ -1,5 +1,8 @@
 2007-10-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/33844
+       * g++.dg/other/ptrmem8.C: New test.
+
        PR c++/33842
        * g++.dg/template/error34.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/other/ptrmem8.C b/gcc/testsuite/g++.dg/other/ptrmem8.C
new file mode 100644 (file)
index 0000000..d0b0ba7
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/33844
+// { dg-do compile }
+
+struct A {};
+
+template<int> void foo(void (A::* f)())
+{
+  A a;
+  &(a.*f);     // { dg-error "invalid use of\[^\n\]*\\.\\*\[^\n\]*to form|qualified-id is required" }
+}
+
+template<int> void bar(void (A::* f)())
+{
+  A *p;
+  &(p->*f);    // { dg-error "invalid use of\[^\n\]*->\\*\[^\n\]*to form|qualified-id is required" }
+}