This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] c++/60760 - arithmetic on null pointers should not be allowed in constant expressions


On 06/20/2016 10:17 PM, Martin Sebor wrote:
+      && tree_int_cst_equal (lhs, null_pointer_node)
+      && !tree_int_cst_equal (rhs, integer_zero_node))

Not integer_zerop?

+			    "invalid conversion involving a null pointer");
...
+			    "invalid conversion from %qT to %qT",

The conversion isn't invalid, it just isn't a constant expression. For the null pointer to pointer conversion, does this properly allow conversion to void* or to base*?

+	    if (integer_zerop (op))
...
+         else if (!integer_zerop (op))

The second test seems redundant.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]