https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78420
--- Comment #29 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #28) > I can commit a patch that fixes the original testcase, but I now think that > the resolution of https://wg21.link/lwg2450 requires compiler help of some > kind, at least for cases like comment 27. It effectively says "if x < y uses > the built-in operator< for pointers, that comparison yields a total order". > That's very different to "if x and y are pointers, comparing them yields a > total order". The library can't tell whether x < y uses a built-in operator > for pointers, because there could be conversions involved, so the library > can't decide whether the cast to uintptr_t is needed. https://github.com/ericniebler/stl2/issues/154#issuecomment-311828747 suggests a rather disgusting way for the library to decide whether the built-in operator for pointers would be used.