<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/152543>152543</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libcxx] calling find() on a map with a non-empty transparent comparator causes a compilation failure (found in PoDoFo)
        </td>
    </tr>

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

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          vimproved
      </td>
    </tr>
</table>

<pre>
    Since libc++ 21, calling find() on a map with a non-empty transparent comparator causes a compilation failure (no member named '__get_value' in 'std::pair<const std::string, int>'). This bug was found in the wild in PoDoFo 0.10.3, see https://bugs.gentoo.org/961184.

```cpp
#include <map>
#include <string>
#include <string_view>

struct my_comp : std::less<> {
  int i;
};

auto test(std::map<std::string, int, my_comp>& m, std::string_view v) {
 m.find(v);
}
```

<details>

<summary>compilation error</summary>

```
In file included from test.cpp:1:
/usr/include/c++/v1/map:700:24: error: no member named '__get_value' in 'std::pair<const std::string, int>'
  700 |     return __comp_(__x.__get_value().first, __y);
      |                    ~~~ ^
/usr/include/c++/v1/__tree:2050:10: note: in instantiation of function template specialization 'std::__map_value_compare<std::string, std::pair<const std::string,
      int>, my_comp>::operator()<std::string_view>' requested here
 2050 |     if (!value_comp()(__root->__value_, __v)) {
      | ^
/usr/include/c++/v1/__tree:1993:18: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
 std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::__lower_bound<std::string_view>' requested here
 1993 |   iterator __p = __lower_bound(__v, __root(), __end_node());
      | ^
/usr/include/c++/v1/map:1249:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
 std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::find<std::string_view>' requested here
 1249 |     return __tree_.find(__k);
      |                    ^
test.cpp:8:5: note: in instantiation of function template specialization 'std::map<std::string, int, my_comp>::find<std::string_view, 0>' requested here
    8 |   m.find(v);
 |     ^
In file included from test.cpp:1:
/usr/include/c++/v1/map:695:29: error: no member named '__get_value' in 'std::pair<const std::string, int>'
  695 |     return __comp_(__x, __y.__get_value().first);
      |                         ~~~ ^
/usr/include/c++/v1/__tree:1994:24: note: in instantiation of function template specialization 'std::__map_value_compare<std::string, std::pair<const std::string,
      int>, my_comp>::operator()<std::string_view>' requested here
 1994 |   if (__p != end() && !value_comp()(__v, *__p))
      | ^
/usr/include/c++/v1/map:1249:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
 std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::find<std::string_view>' requested here
 1249 |     return __tree_.find(__k);
      |                    ^
test.cpp:8:5: note: in instantiation of function template specialization 'std::map<std::string, int, my_comp>::find<std::string_view, 0>' requested here
    8 |   m.find(v);
 |     ^
2 errors generated.
```

</details>
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWEFzozgT_TXypSsUNMaYgw-OE6q-21e1e1fJ0La1CxIrCWeyh_ntWw0EOzPJbrKVmcvGRZVBiFb366fXkpT3-miINiK7FdndQvXhZN3mrNvO2TPVi72tHze_aFMRNHpfCbwVeAuYCNxBpZpGmyMctKkFrgUWYA0oaFUHDzqcQIGx5obaLjxCcMr4TjkyASrbdsqpYB1UqvfkQQ1tulFBWwMHpZveEQhcGwsttXtyYFRLNQjMpTxSkGfV9CQwB2240YdapFuRbjulnUh3lTU-wNzqg9PmyE5rE0R6LzAXWETw60l72PdHeFAeDrY3NdsLJ4IH3Qz3_7d3trQQR0kcpWzAE8EphM6zZSwFlvv-6KMjmWBtZN1RYFmskmS9jES85WsVj1fVdfyIqTZV09cEIt21qmN3vm2e_H31jTxrephexxxdXwVoHyWjCCLdXiJvyHuR7kR6DyK_FfEWGALQIuUHkd9NN_FW9c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