semantics.c (cxx_eval_constant_expression, [...]): Tidy.
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 4 May 2012 22:43:33 +0000 (22:43 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 4 May 2012 22:43:33 +0000 (22:43 +0000)
2012-05-04  Paolo Carlini  <paolo.carlini@oracle.com>

     * semantics.c (cxx_eval_constant_expression, case CONVERT_EXPR): Tidy.

From-SVN: r187184

gcc/cp/ChangeLog
gcc/cp/semantics.c

index 560722c7f1cb5a2bf17a30416960744f6d7a0777..4a5c36fdca890f79a2444d5d3d55fad9618c5264 100644 (file)
@@ -1,3 +1,7 @@
+2012-05-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * semantics.c (cxx_eval_constant_expression, case CONVERT_EXPR): Tidy.
+
 2012-05-04  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/53166
index 90378dc4122ee3702a4cf30db8f8db0e320797c2..fbb26b223755510808031c08ecf32f0b5a77b950 100644 (file)
@@ -7757,18 +7757,16 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
     case NOP_EXPR:
       {
        tree oldop = TREE_OPERAND (t, 0);
-       tree op = oldop;
-       tree to = TREE_TYPE (t);
-       op = cxx_eval_constant_expression (call, TREE_OPERAND (t, 0),
-                                          allow_non_constant, addr,
-                                          non_constant_p);
+       tree op = cxx_eval_constant_expression (call, oldop,
+                                               allow_non_constant, addr,
+                                               non_constant_p);
        if (*non_constant_p)
          return t;
        if (op == oldop)
          /* We didn't fold at the top so we could check for ptr-int
             conversion.  */
          return fold (t);
-       r = fold_build1 (TREE_CODE (t), to, op);
+       r = fold_build1 (TREE_CODE (t), TREE_TYPE (t), op);
        /* Conversion of an out-of-range value has implementation-defined
           behavior; the language considers it different from arithmetic
           overflow, which is undefined.  */