https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122658
--- Comment #5 from mkryss <mkryss at proton dot me> ---
Sorry I should have added more context, the problem is that the code is already
something like this:
if (processing_template_decl)
{
// ...
if (immediate_invocation_p (fn))
{
// ...
if (obj_arg
&& is_dummy_object (obj_arg)
&& !type_dependent_expression_p (obj_arg))
{
exprimm = build_cplus_new (DECL_CONTEXT (fn), expr, complain);
obj_arg = NULL_TREE;
}
// ...
fold_non_dependent_expr (exprimm, complain,
/*manifestly_const_eval=*/true,
obj_arg);
}
}
That's also why I was confused, since that code block just ICEs all the times
it runs.