On 9/10/19 11:18 AM, Marek Polacek wrote:
We started to reject this testcase with r269078, whereby we perform constexpr
evaluation on pre-cp_fold_function bodies.  In this test that causes a problem
because the offset argument of a PREINCREMENT_EXPR was a FLOAT_EXPR, and then
the call to fold_build2 doesn't produce a REAL_CST and VERIFY_CONSTANT triggers.

So we need to fold the offset.  But we can't use cxx_eval_constant_expression
because offset can be stuff like "(int*) 4" which is invalid in constexpr.

But we have fold_simple which uses const_unop, and that is precisely the
function that can bash those FLOAT_EXPRs down to REAL_CSTs.

Bootstrapped/regtested on x86_64-linux, ok for trunk/9?

2019-09-10  Marek Polacek  <pola...@redhat.com>

        PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
        * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
        the offset.

OK.

Jason

Reply via email to