* g++.dg/conversion/nullptr1.C: New test case.
* g++.dg/conversion/nullptr2.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112734
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-04-06 Roger Sayle <roger@eyesopen.com>
+
+ * call.c (null_ptr_cst_p): Add explicit TREE_CONSTANT_OVERFLOW check.
+
2006-04-05 Jason Merrill <jason@redhat.com>
* name-lookup.c (push_namespace_with_attribs): Temporarily disable
(_expr.const_) rvalue of integer type that evaluates to zero. */
t = integral_constant_value (t);
if (t == null_node
- || (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t)))
+ || (CP_INTEGRAL_TYPE_P (TREE_TYPE (t))
+ && integer_zerop (t)
+ && !TREE_CONSTANT_OVERFLOW (t)))
return true;
return false;
}
+2006-04-06 Roger Sayle <roger@eyesopen.com>
+
+ * g++.dg/conversion/nullptr1.C: New test case.
+ * g++.dg/conversion/nullptr2.C: Likewise.
+
2006-04-05 Roger Sayle <roger@eyesopen.com>
* gfortran.dg/dependency_18.f90: New test case.
--- /dev/null
+/* Test for overflow in NULL pointer constant. */
+/* { dg-do compile } */
+
+#include <limits.h>
+
+void *p = 0;
+
+void *q = 0 * (INT_MAX + 1); // { dg-error "invalid conversion" }
+
+
--- /dev/null
+/* Test for enumeration as NULL pointer constant. */
+/* PR c++/14644 */
+/* { dg-do compile } */
+
+enum { NULL = 0 };
+
+void *p = 0;
+
+void *q = NULL; // { dg-error "cannot convert" }
+