PR c++/56998
* call.c (null_ptr_cst_p): An expression with side-effects can't
be a C++03 null pointer constant.
From-SVN: r198845
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.
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))
--- /dev/null
+// PR c++/56998
+
+class Secret;
+char IsNullLiteralHelper(Secret* p);
+char (&IsNullLiteralHelper(...))[2];
+
+struct C
+{
+ int val() { return 42; }
+};
+
+template <typename T>
+unsigned f()
+{
+ return sizeof(IsNullLiteralHelper(C().val()));
+}