aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-13 19:34:29 +0000
committerJason Merrill <jason@redhat.com>2013-05-13 19:34:29 +0000
commit01679e531b1d14eaeb5bd649b8b6838b36acf64b (patch)
tree20956571f929e8aa4e70ad8bda9ba92d1e38435b /gcc/cp
parent3072243195fb1cd558ccf82fd26b03fd9792a059 (diff)
PR c++/56998
* call.c (null_ptr_cst_p): An expression with side-effects can't be a C++03 null pointer constant. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@198851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ca7211c4785..25386141c73 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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.
+
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 72c1dac2566..b2755a8116a 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)
+ if (cxx_dialect < cxx0x && !TREE_SIDE_EFFECTS (t))
t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t))