]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
call.c (convert_like_real): Call print_z_candidate and inform only if permerror retur...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 15 Jul 2014 13:41:58 +0000 (13:41 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 15 Jul 2014 13:41:58 +0000 (13:41 +0000)
2014-07-15  Paolo Carlini  <paolo.carlini@oracle.com>

* call.c (convert_like_real): Call print_z_candidate and inform only
if permerror returns true.

From-SVN: r212560

gcc/cp/ChangeLog
gcc/cp/call.c

index 9ffee53b6c9e03d1a647da1acff78fb61456fa69..697ba793c73d274dc5085b8164fdd15d4a858507 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * call.c (convert_like_real): Call print_z_candidate and inform only
+       if permerror returns true.
+
 2014-07-14  Jan Hubicka  <hubicka@ucw.cz>
 
        * class.c (build_clone): Do not clear assembler names of
index b16c6e421674090c8bd7b7c50aee30032748aa82..6da1218042f53bf838992642a52d460f2f347019 100644 (file)
@@ -6076,9 +6076,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
        {
          if (t->kind == ck_user && t->cand->reason)
            {
-             permerror (loc, "invalid user-defined conversion "
-                        "from %qT to %qT", TREE_TYPE (expr), totype);
-             print_z_candidate (loc, "candidate is:", t->cand);
+             complained = permerror (loc, "invalid user-defined conversion "
+                                     "from %qT to %qT", TREE_TYPE (expr),
+                                     totype);
+             if (complained)
+               print_z_candidate (loc, "candidate is:", t->cand);
              expr = convert_like_real (t, expr, fn, argnum, 1,
                                        /*issue_conversion_warnings=*/false,
                                        /*c_cast_p=*/false,
@@ -6089,7 +6091,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
                                             complain);
              else
                expr = cp_convert (totype, expr, complain);
-             if (fn)
+             if (complained && fn)
                inform (DECL_SOURCE_LOCATION (fn),
                        "  initializing argument %P of %qD", argnum, fn);
              return expr;