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

login
register
mail settings
Submitter Paolo Carlini
Date Nov. 7, 2013, 7:50 p.m.
Message ID <527BEF0E.6030409@oracle.com>
Download mbox | patch
Permalink /patch/289471/
State New
Headers show

Comments

Paolo Carlini - Nov. 7, 2013, 7:50 p.m.
... well, something like this seems better to me. Only lightly tested so 
far, sorry.

Paolo.

///////////////////////

Patch

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;
 }