re PR c++/49117 (4.5 -> 4.6: user-unfriendly change in "invalid conversion" error...
authorJason Merrill <jason@redhat.com>
Tue, 14 Jun 2011 18:16:06 +0000 (14:16 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 14 Jun 2011 18:16:06 +0000 (14:16 -0400)
PR c++/49117
* call.c (perform_implicit_conversion_flags): Print source type as
well as expression.

From-SVN: r175044

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error23.C
gcc/testsuite/g++.dg/other/error32.C

index 5970440..0fc8eab 100644 (file)
@@ -1,5 +1,9 @@
 2011-06-14  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49117
+       * call.c (perform_implicit_conversion_flags): Print source type as
+       well as expression.
+
        PR c++/49389
        * typeck2.c (build_m_component_ref): Preserve rvalueness.
 
index 4ee0eaf..b43d078 100644 (file)
@@ -8296,7 +8296,8 @@ perform_implicit_conversion_flags (tree type, tree expr, tsubst_flags_t complain
          else if (invalid_nonstatic_memfn_p (expr, complain))
            /* We gave an error.  */;
          else
-           error ("could not convert %qE to %qT", expr, type);
+           error ("could not convert %qE from %qT to %qT", expr,
+                  TREE_TYPE (expr), type);
        }
       expr = error_mark_node;
     }
index 1ca37e3..e32f53e 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-14  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/other/error23.C: Adjust error message.
+       * g++.dg/other/error32.C: Likewise.
+
        PR c++/49389
        * g++.dg/cpp0x/rv-dotstar.C: New.
 
index 0ff1915..959fe40 100644 (file)
@@ -2,4 +2,4 @@
 // { dg-do compile }
 
 int v __attribute ((vector_size (8)));
-bool b = !(v - v);     // { dg-error "could not convert .\\(__vector.2. int\\)\\{0, 0\\}. to .bool.|in argument to unary" }
+bool b = !(v - v);     // { dg-error "could not convert .\\(__vector.2. int\\)\\{0, 0\\}. from .__vector.2. int. to .bool.|in argument to unary" }
index 35c64c4..56d3b7a 100644 (file)
@@ -3,6 +3,6 @@
 
 void foo()
 {
-  if (throw 0) // { dg-error "could not convert .\\<throw-expression\\>. to .bool." }
+  if (throw 0) // { dg-error "could not convert .\\<throw-expression\\>. from .void. to .bool." }
     ;
 }