diff mbox

C++ PATCH for c++/49117 (error message regression on conversion failure)

Message ID 4DF79CA1.7010001@redhat.com
State New
Headers show

Commit Message

Jason Merrill June 14, 2011, 5:38 p.m. UTC
PR 49117 complains that the error message given on conversion failure 
regressed from 4.5 to 4.6 in that it no longer prints the source type. 
So I've added it back in.

While I was at it, I've also tweaked the compiler to also print the 
typedef-stripped version of a type when appropriate, which should help 
with understanding template error messages.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
diff mbox

Patch

commit 16136651e85c19a1e8338a0bd1b2b1a453413c23
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 14 09:43:25 2011 -0400

    	* error.c (type_to_string): Print typedef-stripped version too.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 96796c2..22470dc 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2632,6 +2632,15 @@  type_to_string (tree typ, int verbose)
 
   reinit_cxx_pp ();
   dump_type (typ, flags);
+  if (typ && TYPE_P (typ) && typ != TYPE_CANONICAL (typ)
+      && !uses_template_parms (typ))
+    {
+      tree aka = strip_typedefs (typ);
+      pp_string (cxx_pp, " {aka");
+      pp_cxx_whitespace (cxx_pp);
+      dump_type (aka, flags);
+      pp_character (cxx_pp, '}');
+    }
   return pp_formatted_text (cxx_pp);
 }