On 2025-12-07 13:28, Patrick Palka wrote:
> > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
> > index 7a019d33bda..f992bf5c0bb 100644
> > --- a/gcc/cp/pt.cc
> > +++ b/gcc/cp/pt.cc
> > @@ -24815,8 +24815,6 @@ resolve_nondeduced_context (tree orig_expr,
> > tsubst_flags_t complain)
> > }
> > if (good == 1)
> > {
> > - if (!mark_used (goodfn, complain) && !(complain & tf_error))
> > - return error_mark_node;
>
> Huh, interestingly this change alone is sufficient to fix the
> testcase from the PR because it causes convert_to_void to exit
> early, returning error_mark_node instead of ultimately returning
> void_cst (TREE_SIDE_EFFECTS is not set on error_mark_node):
>
> expr = resolve_nondeduced_context (expr, complain);
> if (!mark_single_function (expr, complain))
> return error_mark_node;
> ...
> if (!TREE_SIDE_EFFECTS (expr))
> expr = void_node;
> return expr;
>
> (which seems like another bug, convert_to_void shouldn't be replacing
> error_mark_node with void_cst!)
>
> If the resolve_nondeduced_context change is sufficient to fix the PR,
> and doesn't cause any other diagnostic changes in the testsuite, I think
> we should go with that as the proper fix for the PR. We should consider
> the error_mark_node early exits from mark_used/single_function (along
> with the testsuite adjustments) as a separate patch. Could you split
> the patch into two then?
>
Yes, I'll resubmit both patches separately.