--- Comment #27 from Jonathan Wakely <redi at gcc dot> ---
Here's a really horrible case:

#include <functional>
#include <cassert>

struct X {
  operator const X*() const { return this; }

X x;
X y;

int main()
  std::less<> lt;
  bool x_less_than_y = lt(x, y);
  bool y_less_than_x = lt(y, x);
  bool x_equal_to_y = !lt(x, y) && !lt(y, x);
  assert( ((int)x_less_than_y + (int)y_less_than_x + (int)x_equal_to_y) == 1 );

This happens to give the right answer today, but I don't trust it to always do
so. We can't dispatch to the special case for pointers that casts to uintptr_t
because we can't know that we'll be comparing pointers (without
std::experimental::invocation_type at least ... so I guess I finally have a use
case for that).

Reply via email to