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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-07-22
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot 
gnu.org

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
I think we just need to explicitly qualify the ambiguous member lookups:

--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1015,8 +1015,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        decltype(auto)
        _S_call(_Tp&& __g, index_sequence<_Ind...>, _CallArgs&&... __call_args)
        {
-         return std::invoke(std::forward<_Tp>(__g)._M_fd,
-             std::get<_Ind>(std::forward<_Tp>(__g)._M_bound_args)...,
+         return std::invoke(std::forward<_Tp>(__g)._Bind_front::_M_fd,
+            
std::get<_Ind>(std::forward<_Tp>(__g)._Bind_front::_M_bound_args)...,
              std::forward<_CallArgs>(__call_args)...);
        }

_Bind_back and the other users of deducing this in the stdlib should get
audited/fixed accordingly.

FWIW the deducing this paper has a couple of sections about this pitfall:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0847r7.html#name-lookup-within-member-functions
and the one after that.

Reply via email to