<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Unqualified calls of std::ref lead to ADL issues"
   href="https://bugs.llvm.org/show_bug.cgi?id=44398">44398</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unqualified calls of std::ref lead to ADL issues
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arthur.j.odwyer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Unqualified calls of std::get lead to ADL issues"
   href="show_bug.cgi?id=20092">https://bugs.llvm.org/show_bug.cgi?id=20092</a> is related, but for `get` instead
of `ref`.

// <a href="https://gcc.godbolt.org/z/8VfprT">https://gcc.godbolt.org/z/8VfprT</a>
#include <functional>

struct S {
    friend void ref(S);
    friend void deref(S);
};
int main() {
    S s;
    auto rw = std::ref(s);    // OK
    auto rw2 = std::ref(rw);  // massive error spew
}


Currently <__functional_base> has

    template <class _Tp>
    inline _LIBCPP_INLINE_VISIBILITY
    reference_wrapper<_Tp>
    ref(reference_wrapper<_Tp> __t) _NOEXCEPT
    {
        return ref(__t.get());
    }

It should have

        return _VSTD::ref(__t.get());

or simply (LWG 3146)

        return __t;

There's also an unqualified ADL `ref` in <memory>:

// <a href="https://gcc.godbolt.org/z/EHw3Gy">https://gcc.godbolt.org/z/EHw3Gy</a>
#include <memory>
#include <utility>

struct D {
    void operator()(int *) const;
    friend void ref(D);
    friend void deref(D);
};
int main() {
    D d;
    std::unique_ptr<int, D&> u(nullptr, d);
    std::shared_ptr<int> s = std::move(u);
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>