public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/48284 (-> instead of . in error message)
@ 2011-05-27 22:45 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-05-27 22:45 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

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

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: 48284.patch --]
[-- Type: text/x-patch, Size: 1177 bytes --]

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" }
+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-27 19:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 22:45 C++ PATCH for c++/48284 (-> instead of . in error message) Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).