+2011-08-23 Jason Merrill <jason@redhat.com>
+
+ Core 903 (partial)
+ * call.c (null_ptr_cst_p): Only 0 qualifies in C++11.
+
2011-08-23 Jason Merrill <jason@redhat.com>
Core 975
return true;
if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)))
{
- if (cxx_dialect >= cxx0x)
- {
- t = fold_non_dependent_expr (t);
- t = maybe_constant_value (t);
- if (TREE_CONSTANT (t) && integer_zerop (t))
- return true;
- }
- else
+ /* Core issue 903 says only literal 0 is a null pointer constant. */
+ if (cxx_dialect < cxx0x)
{
t = integral_constant_value (t);
STRIP_NOPS (t);
- if (integer_zerop (t) && !TREE_OVERFLOW (t))
- return true;
}
+ if (integer_zerop (t) && !TREE_OVERFLOW (t))
+ return true;
}
return false;
}
constexpr int zero() { return 0; }
-void* ptr1 = zero(); // #1
-constexpr void* ptr2 = zero(); // #2
+void* ptr1 = zero(); // { dg-error "int" }
+constexpr void* ptr2 = zero(); // { dg-error "int" }