https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121327

--- Comment #1 from Borislav Stanimirov <b.stanimirov at abv dot bg> ---
So, the problem is that `std::equality_comparable_with` is bidirectional.

It checks lhs==rhs and rhs==lhs. Using it with two id<X> types will lead to an
infinite recursion of checking `rhs==X`. The reason this works on msvc is
because msstl uses `&&` for this concept and does not check the second
condition (leading to an infinite recursion) if the first is false. Maybe
gcc/libstdc++ should do the same?

In any case the workaround for this particular use case is to ditch
`std::equality_comparable_with` and use something like:

```
template <typename T, typename U>
concept unidir_eq_cmp_with = requires(const T& lhs, const U& rhs) {
    { lhs == rhs } -> std::convertible_to<bool>;
};
```

Reply via email to