]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cvt.c (cp_convert_and_check): Avoid calling cp_convert unnecessarily.
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 26 Nov 2013 10:12:30 +0000 (10:12 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 26 Nov 2013 10:12:30 +0000 (10:12 +0000)
2013-11-26  Paolo Carlini  <paolo.carlini@oracle.com>

* cvt.c (cp_convert_and_check): Avoid calling cp_convert
unnecessarily.

From-SVN: r205387

gcc/cp/ChangeLog
gcc/cp/cvt.c

index 64f9a23632db3289c226d975d137e56ae9f8efbd..143885cea1c2c3d18cacce1e191201b447d68693 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * cvt.c (cp_convert_and_check): Avoid calling cp_convert
+       unnecessarily.
+
 2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/54485
index c1dfdcf3599fac359b963f506c62414e74a3aae2..ecec24a511858c266562be828b450656af8616ef 100644 (file)
@@ -630,7 +630,8 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
     {
       tree folded = maybe_constant_value (expr);
       tree stripped = folded;
-      tree folded_result = cp_convert (type, folded, complain);
+      tree folded_result
+       = folded != expr ? cp_convert (type, folded, complain) : result;
 
       /* maybe_constant_value wraps an INTEGER_CST with TREE_OVERFLOW in a
         NOP_EXPR so that it isn't TREE_CONSTANT anymore.  */