aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2012-12-08 01:19:13 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2012-12-08 01:19:13 +0000
commit3da2b176b387f367a02f5299607204ee6b27e359 (patch)
tree4c535a0da796f017a8885686ffc62ef2d9e1130a /gcc/cp/semantics.c
parentcea55d343c4e04b1c2bd568d809c791f8c98c088 (diff)
downloadgcc-3da2b176b387f367a02f5299607204ee6b27e359.zip
gcc-3da2b176b387f367a02f5299607204ee6b27e359.tar.gz
gcc-3da2b176b387f367a02f5299607204ee6b27e359.tar.bz2
re PR c++/55513 (Incorrect snprintf folding when building with -std=c++0x)
PR c++/55513 * semantics.c (cxx_eval_builtin_function_call): Set non_constant_p after folding. From-SVN: r194316
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 491d97c..92b4a2b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -45,6 +45,13 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "hash-table.h"
+static bool verify_constant (tree, bool, bool *, bool *);
+#define VERIFY_CONSTANT(X) \
+do { \
+ if (verify_constant ((X), allow_non_constant, non_constant_p, overflow_p)) \
+ return t; \
+ } while (0)
+
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
during template instantiation, which may be regarded as a
@@ -6437,7 +6444,9 @@ cxx_eval_builtin_function_call (const constexpr_call *call, tree t,
return t;
new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
CALL_EXPR_FN (t), nargs, args);
- return fold (new_call);
+ new_call = fold (new_call);
+ VERIFY_CONSTANT (new_call);
+ return new_call;
}
/* TEMP is the constant value of a temporary object of type TYPE. Adjust
@@ -6738,11 +6747,6 @@ verify_constant (tree t, bool allow_non_constant, bool *non_constant_p,
}
return *non_constant_p;
}
-#define VERIFY_CONSTANT(X) \
-do { \
- if (verify_constant ((X), allow_non_constant, non_constant_p, overflow_p)) \
- return t; \
- } while (0)
/* Subroutine of cxx_eval_constant_expression.
Attempt to reduce the unary expression tree T to a compile time value.