diff mbox

[C++,committed] Small diagnostic fix

Message ID 53C52A7F.8020102@oracle.com
State New
Headers show

Commit Message

Paolo Carlini July 15, 2014, 1:19 p.m. UTC
Hi,

while looking into an old issue I noticed that in one place we don't 
check the return value of permerror. I'm going to commit the below as 
obvious.

Thanks,
Paolo.

//////////////////
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.
diff mbox

Patch

Index: call.c
===================================================================
--- call.c	(revision 212545)
+++ call.c	(working copy)
@@ -6076,9 +6076,11 @@  convert_like_real (conversion *convs, tree expr, t
 	{
 	  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, t
 					     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;