https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95074
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This is where we're confused by the function introduced by M::f: /* We do not perform argument-dependent lookup if normal lookup finds a non-function, in accordance with the expected resolution of DR 218. */ else if (!args->is_empty () && is_overloaded_fn (postfix_expression)) { /* We only need to look at the first function, because all the fns share the attribute we're concerned with (all member fns or all local fns). */ tree fn = get_first_fn (postfix_expression); fn = STRIP_TEMPLATE (fn); /* Do not do argument dependent lookup if regular lookup finds a member function or a block-scope function declaration. [basic.lookup.argdep]/3 */ if (!((TREE_CODE (fn) == USING_DECL && DECL_DEPENDENT_P (fn)) || DECL_FUNCTION_MEMBER_P (fn) || DECL_LOCAL_FUNCTION_P (fn))) { koenig_p = true; if (!any_type_dependent_arguments_p (args)) postfix_expression = perform_koenig_lookup (postfix_expression, args, complain); } }