aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-14 08:49:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-14 08:49:08 -0400
commit1a2887689b95dd72960b429650eb2b4c0b1fdcd0 (patch)
treebbc5a40c1185468f33d655ed81b470452ed96719
parentd4c52634cef1d2e86c3b460a1128e3301ecf769d (diff)
downloadgcc-1a2887689b95dd72960b429650eb2b4c0b1fdcd0.zip
gcc-1a2887689b95dd72960b429650eb2b4c0b1fdcd0.tar.gz
gcc-1a2887689b95dd72960b429650eb2b4c0b1fdcd0.tar.bz2
re PR c++/56998 (ICE in value_dependent_expression_p, at cp/pt.c:19598)
PR c++/56998 * semantics.c (potential_constant_expression_1): Make sure the called function is potentially constant. * call.c (null_ptr_cst_p): Revert earlier change. From-SVN: r198881
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/semantics.c6
3 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 38b43d5..aca1ece 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/56998
+ * semantics.c (potential_constant_expression_1): Make sure the
+ called function is potentially constant.
+ * call.c (null_ptr_cst_p): Revert earlier change.
+
2013-05-13 Jason Merrill <jason@redhat.com>
PR c++/56998
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9f3a50d..bd8f531 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 3e78887..92a4917 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8476,7 +8476,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);