<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68591>68591</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
macOS M1 clang++ error: no member named 'lexicographical_compare_three_way' in namespace 'std';
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
notshriram
</td>
</tr>
</table>
<pre>
I have been trying to compile [this example](https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare_three_way) from cppreference
```c++
#include <algorithm>
#include <cctype>
#include <compare>
#include <iomanip>
#include <iostream>
#include <string_view>
#include <utility>
using namespace std::literals;
void show_result(std::string_view s1, std::string_view s2, std::strong_ordering o)
{
std::cout << std::quoted(s1) << " is ";
std::is_lt(o) ? std::cout << "less than ":
std::is_gt(o) ? std::cout << "greater than ":
std::cout << "equal to ";
std::cout << std::quoted(s2) << '\n';
}
std::strong_ordering cmp_icase(unsigned char x, unsigned char y)
{
return std::toupper(x) <=> std::toupper(y);
};
int main()
{
for (const auto& [s1, s2] :
{
std::pair{"one"sv, "ONE"sv}, {"two"sv, "four"sv}, {"three"sv, "two"sv}
})
{
const auto res = std::lexicographical_compare_three_way(
s1.cbegin(), s1.cend(), s2.cbegin(), s2.cend(), cmp_icase);
show_result(s1, s2, res);
}
}
```
I works fine on godbolt but it doesn't seem to compile on my macOS M1
I have been using these commands to compile:
```bash
g++ -std=c++20 test.cpp # Apple Clang 15.0.0
clang++ -std=c++20 test.cpp # Homebrew clang version 16.0.6
```
this is the error for Apple Clang:
```
test.cpp:31:31: error: no member named 'lexicographical_compare_three_way' in namespace 'std'; did you mean 'lexicographical_compare'?
const auto res = std::lexicographical_compare_three_way(
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lexicographical_compare
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/lexicographical_compare.h:42:1: note: 'lexicographical_compare' declared here
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
^
```
this is the error for Homebrew clang 16.0.6:
```
test.cpp:31:31: error: no member named 'lexicographical_compare_three_way' in namespace 'std'; did you mean 'lexicographical_compare'?
const auto res = std::lexicographical_compare_three_way(
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lexicographical_compare
/opt/homebrew/opt/llvm/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:42:1: note: 'lexicographical_compare' declared here
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV82SmzgQfhr50hUKhLHxwQdnPNRObbI5ZA97o4RogzZCIpKwx5c8-5YA23jGzsxhc9qlXGC6W63--bpbMGtFpRDXJPlIku2Mda7WZq20s7URhjWzQpfH9RPUbI9QICpw5ihUBU4D100rJAJJPrpaWMBn1rQSSbIlNK2day2JN4RmhGaoAt62BndoUHEMuG4IzQ6EZrxtCc2YrLQRrvZUic-C68qwthacydxvwwzmrjaI-YEdCV3BzugGpipJuCXhZrwvwuHHCf3ofwOVxkJx2ZUIJH647Bg_3uJz7o4t3mMOJt3hCt0wJdq7XOsMsnv7WmeEqvK9wMMdic4JKdzxzO2sz4diDdqWcQTrSh_3eCOFQ8OkJfEYARgeey1KsLU-5AZtJx2h6XnNZHuwEaEPcJtFX7K0qnJtSvQyoAldjaYvT3sDXOS57px3hcQTJd877bD0xkQ-wyObUArC-sfFjakqYfPeAz2syW5vQiiVaC24mqlB1-a2rupduiqDzKG5re7ldU8Jfu-Y9HV017c3wkSvwrQkyYPyj5Mqstxepf1utnjT5oIzi4SmneobQgm8ZgaefZavSccbqTXoOqMuJjrdtS0aQtPns4lbEj_ekuj1TU1-AVahHDRMKELT26DaaQOEplwr64B1ThO68C1pRC8lyRau8nNZfTanZcJ4MqVaIaHU7v1aQumXPx6H1-W2p_Qy7qCnMjvdmRtCvltNx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