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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem here is that we escalate the callop() and caller via:

finish_call_expr -> build_new_function_call -> perform_overload_resolution ->
add_candidates -> add_template_candidate -> add_template_candidate_real ->
fn_type_unification -> constraints_satisfied_p -> ... -> satisfy_atom ->
maybe_constant_value -> ... -> maybe_instantiate_decl (is_invocable_v) -> ...
-> finish_trait_expr -> trait_expr_value -> build_invoke -> finish_call_expr ->
build_op_call -> build_over_call -> mark_used -> maybe_instantiate_decl ->
instantiate_decl -> instantiate_body -> finish_function -> cp_fold_function.

With "-> void" added, the fn isn't undeduced_auto_decl so in mark_used

    if (undeduced_auto_decl (decl)
        || ...)
    maybe_instantiate_decl (decl);

doesn't trigger.  Without the requires there's no build_invoke call.

Reply via email to