https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65398

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #5)
> Another testcase, derived from one attached to bug 65509:
> 
> char s[] = "s";
> 
> #define SA(X) static_assert((X),#X);
> SA((&s[0] + 0) != (&s[0] + 1));
> 
> here we aren't indirecting the addresses, so I think cxx_fold_indirect_ref
> isn't the right place for the fix.

Yeah.  I think I'll have to massage the POINTER_PLUS_EXPR case in
cxx_eval_constant_expression so we fold the &s[0] + 0 stuff even when we're not
dereferencing the expr.

Reply via email to