| Issue |
61663
|
| Summary |
libc++ should diagnose when std::sort & friends is used with a non strict-weak order
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
ldionne
|
We emit a `diagnose_if` warning in C++20 mode when users call `std::sort` (or other sort-like algorithms) on e.g. floating points with `std::less`, which technically doesn't satisfy a strict weak ordering. There are probably other cases, like `std::greater` and also many more algorithms like `std::partition` and friends.
We could introduce a new heuristic trait like `__is_definitely_not_valid_strict_weak_ordering<Comparator, T, U>`, and that would be true for `std::less`, `std::greater` & friends when used with floating point types.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs