On 07/06/2016 06:20 PM, Martin Sebor wrote:
@@ -2911,6 +2923,14 @@ cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,
if (*non_constant_p)
return t;
+ if (integer_zerop (op0))
+ {
+ if (!ctx->quiet)
+ error ("dereferencing a null pointer");
+ *non_constant_p = true;
+ return t;
+ }
I'm skeptical of checking this here, since *p is valid for null p; &*p is even a constant expression. And removing this hunk doesn't seem to break any of your tests.
OK with that hunk removed. Jason