Issue 160431
Summary clang++/libc++ 21, c++26 operator==(pair<T, expected<U, V>>, pair<T, expected<U, V>>) compilation error
Labels clang, libc++
Assignees
Reporter m2
    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.

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
...
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to