<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 - std::tuple still missing C++20 three-way spaceship operator<=>"
href="https://bugs.llvm.org/show_bug.cgi?id=51052">51052</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::tuple still missing C++20 three-way spaceship operator<=>
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Standards Issues
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>root.main@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>In the C++20 standard, std::tuple is meant to have its old {<,<=,==,!=,>=,>}
comparison operators deprecated in favor of the three-way comparison spaceship
operator, <=>. In the very latest iteration of libc++ (currently
1:13~++20210710113609+8cf7ddbdd4e5-1~exp1~20210710094359.522), this has yet to
be the case.
Example:
clang-13 -xc++ -std=c++20 -stdlib=libstdc++ -lstdc++ <(cat <<EOF
#include <tuple>
int main(int, char**) {
int a = 1, b = 1;
auto compared = std::tie(a) <=> std::tie(b);
return compared < 0;
}
EOF
) && ./a.out && echo "okay"
The above command prints "okay", because libstdc++ supports <=> comparison
between std::tuples.
clang-13 -xc++ -std=c++20 -stdlib=libc++ -lc++ <(cat <<EOF
#include <tuple>
int main(int, char**) {
int a = 1, b = 1;
auto compared = std::tie(a) <=> std::tie(b);
return compared < 0;
}
EOF
) && ./a.out && echo "okay"
The above command fails to compile the program, with the following error
message:
error: invalid operands to binary expression ('tuple<int &>' and 'tuple<int
&>')
auto compared = std::tie(a) <=> std::tie(b);
~~~~~~~~~~~ ^ ~~~~~~~~~~~
Further investigation reveals that the <tuple> header contains no definitions
for operator<=>, and my efforts to locate a TODO for this feature in the libc++
effort have come up fruitless.</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>