-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Description
The following depends on clang/libc++ 21 and c++26 enabled as the constraints on operator== methods pointed to by compilation errors aren't present otherwise. I don't understand what's going on well enough to know where the fault lies but suspect the following examples should compile successfully.
This yields various methods of associative containers with a std::expected mapped_type not compiling.
int parameters below chosen arbitrarily, appears to affect any choice.
Compile the following with clang++ -std=c++2c -stdlib=libc++ yields "satisfaction of constraint ... depends on itself" errors:
#include <map>
#include <expected>
int main()
{
using E = std::expected<int, int>;
using M = std::multimap<int, E>;
M m;
m.count(0); // error
return 0;
}
->
usr/lib/llvm-21/bin/../include/c++/v1/__expected/expected.h:1169:49: error: satisfaction of constraint 'requires { { *__x == __v } -> __core_convertible_to<bool>; }'
depends on itself
...
Which can be distilled to similar "depends on itself" errors on operator== of the value_type:
#include <expected>
#include <utility>
using E = std::expected<int, int>;
using P = std::pair<int, E>;
int main()
{
E e1, e2;
bool b = e1 == e2; // ok
P p1, p2;
p1 == p2; // error
return 0;
}
->
/usr/lib/llvm-21/bin/../include/c++/v1/__expected/expected.h:1169:49: error: satisfaction of constraint 'requires { { *__x == __v } -> __core_convertible_to<bool>; }'
depends on itself
...
Metadata
Metadata
Assignees
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.