On 12/20/18 4:40 PM, Jakub Jelinek wrote:
On Thu, Dec 20, 2018 at 04:26:21PM -0500, Jason Merrill wrote:
Right, but they either are or they aren't. Doing this isn't likely to help
anything, and can lead to paradoxical results in contrived testcases.
But if you think this is a bad idea, I can remove it, I haven't been
successful in constructing a testcase where this would matter.
Please. OK with those changes.
Actually, the main reason for any changes in that block was mainly that I
thought
it is a bad idea to fold the argument with __builtin_is_const_evaluated ()
folded into true if that argument isn't a constant expression.
So are you ok with what is in the patch below, i.e.
{
bool non_cst_p = false, ovf_p = false;
tree a = cxx_eval_constant_expression (&new_ctx, args[i], false,
&non_cst_p, &ovf_p);
if ((!non_cst_p && !ovf_p) || !ctx->manifestly_const_eval)
args[i] = a;
}
, or perhaps without the || !ctx->manifestly_const_eval?
I don't see how that makes a difference from what was there before; if
the argument to cxx_eval_constant_expression is non-constant, it returns
the argument unchanged.
So, if the
argument is a constant expression, fold to that, if it is not, just do
cp_fully_fold on it if it is __builtin_constant_p, otherwise nothing?
Hmm, cp_fully_fold probably also needs to add a manifestly_const_eval
parameter to pass along to maybe_constant_value.
Jason