[C++ Patch / RFC] Fixing a diagnostic regression caused by the fix for c++/56930

Paolo Carlini paolo.carlini@oracle.com
Thu Nov 7 20:14:00 GMT 2013


... well, something like this seems better to me. Only lightly tested so 
far, sorry.

Paolo.

///////////////////////
-------------- next part --------------
Index: cvt.c
===================================================================
--- cvt.c	(revision 204536)
+++ cvt.c	(working copy)
@@ -621,24 +621,25 @@ cp_convert_and_check (tree type, tree expr, tsubst
 
   if (TREE_TYPE (expr) == type)
     return expr;
-  
-  result = cp_convert (type, expr, complain);
 
   if ((complain & tf_warning)
       && c_inhibit_evaluation_warnings == 0)
     {
       tree folded = maybe_constant_value (expr);
       tree stripped = folded;
-      tree folded_result = cp_convert (type, folded, complain);
 
+      result = cp_convert (type, folded, complain);
+
       /* maybe_constant_value wraps an INTEGER_CST with TREE_OVERFLOW in a
 	 NOP_EXPR so that it isn't TREE_CONSTANT anymore.  */
       STRIP_NOPS (stripped);
 
       if (!TREE_OVERFLOW_P (stripped)
-	  && folded_result != error_mark_node)
-	warnings_for_convert_and_check (type, folded, folded_result);
+	  && result != error_mark_node)
+	warnings_for_convert_and_check (type, folded, result);
     }
+  else
+    result = cp_convert (type, expr, complain);
 
   return result;
 }


More information about the Gcc-patches mailing list