This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/48284 (-> instead of . in error message)


We already handle reference refs properly elsewhere, but needed to handle it here as well.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 1e9af8c4d3c615f04f456306587959cdd6c49c26
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 27 10:54:40 2011 -0400

    	PR c++/48284
    	* error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot
    	with INDIRECT_REF of REFERENCE_TYPE.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 8d7aaa7..a40630a 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -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
diff --git a/gcc/testsuite/g++.dg/cpp0x/error6.C b/gcc/testsuite/g++.dg/cpp0x/error6.C
new file mode 100644
index 0000000..482aafb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/error6.C
@@ -0,0 +1,9 @@
+// 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" }
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]