[llvm-bugs] [Bug 51052] New: std::tuple still missing C++20 three-way spaceship operator<=>
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jul 11 01:23:41 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51052
Bug ID: 51052
Summary: std::tuple still missing C++20 three-way spaceship
operator<=>
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Standards Issues
Assignee: unassignedclangbugs at nondot.org
Reporter: root.main at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210711/55dbb4ee/attachment.html>
More information about the llvm-bugs
mailing list