aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-14 12:51:17 +0000
committerJason Merrill <jason@redhat.com>2013-05-14 12:51:17 +0000
commit92b113103653ce32e79a66c1f94a7390b8d9ea67 (patch)
treebc56b5c617dbd73bb6c6c67eac79b78f16d6a053 /gcc/cp
parenta4cf516323109796d3ffafcafd7d762de142904b (diff)
PR c++/56998
* semantics.c (potential_constant_expression_1): Make sure the called function is potentially constant. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@198882 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/semantics.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 25386141c73..9c59359188a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,8 +1,8 @@
2013-05-13 Jason Merrill <jason@redhat.com>
PR c++/56998
- * call.c (null_ptr_cst_p): An expression with side-effects can't
- be a C++03 null pointer constant.
+ * semantics.c (potential_constant_expression_1): Make sure the
+ called function is potentially constant.
PR c++/57041
* decl.c (reshape_init_class): Handle error_mark_node.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index b2755a8116a..72c1dac2566 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -554,7 +554,7 @@ null_ptr_cst_p (tree t)
if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)))
{
/* Core issue 903 says only literal 0 is a null pointer constant. */
- if (cxx_dialect < cxx0x && !TREE_SIDE_EFFECTS (t))
+ if (cxx_dialect < cxx0x)
t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t))
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 1953c598538..8a7fe38074d 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8411,7 +8411,11 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
}
}
else
- fun = get_first_fn (fun);
+ {
+ if (!potential_constant_expression_1 (fun, true, flags))
+ return false;
+ fun = get_first_fn (fun);
+ }
/* Skip initial arguments to base constructors. */
if (DECL_BASE_CONSTRUCTOR_P (fun))
i = num_artificial_parms_for (fun);