re PR c++/48284 ([C++0x] incorrect printing of decltype operand in diagnostic)
authorJason Merrill <jason@redhat.com>
Fri, 27 May 2011 19:31:59 +0000 (15:31 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 27 May 2011 19:31:59 +0000 (15:31 -0400)
PR c++/48284
* error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot
with INDIRECT_REF of REFERENCE_TYPE.

From-SVN: r174353

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/error6.C [new file with mode: 0644]

index 332b98cbf93095ee2121603a69f0321012776b46..19ef7caec271018f2e76a192e6f64e35ec1403b3 100644 (file)
@@ -1,5 +1,9 @@
 2011-05-27  Jason Merrill  <jason@redhat.com>
 
+       PR c++/48284
+       * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot
+       with INDIRECT_REF of REFERENCE_TYPE.
+
        PR c++/49181
        * pt.c (get_mostly_instantiated_function_type): Use push_access_scope.
 
index 8d7aaa71c85a302bec338fc534d472972654fa61..a40630ac9c3ee33aa8259356ed832c7c6b91fe47 100644 (file)
@@ -1890,7 +1890,10 @@ dump_expr (tree t, int flags)
                    && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")))
              {
                dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
-               pp_cxx_arrow (cxx_pp);
+               if (TREE_CODE (TREE_TYPE (ob)) == REFERENCE_TYPE)
+                 pp_cxx_dot (cxx_pp);
+               else
+                 pp_cxx_arrow (cxx_pp);
              }
          }
        else
index 474b8579456b0fd6c0448aff66bf057b3f855c3d..d034def5f3f70fe37e6fe49e6f05e9fbd9e9b1f8 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-27  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/error6.C: New.
+
        * g++.dg/cpp0x/error5.C: New.
 
 2011-05-27  Jakub Jelinek  <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/error6.C b/gcc/testsuite/g++.dg/cpp0x/error6.C
new file mode 100644 (file)
index 0000000..3515652
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/48284
+// { dg-options -std=c++0x }
+
+template<typename C>
+auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" }
+
+template<typename C>
+auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" }