https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113159
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- I haven't seen a proof that libstdc++'s std::sort can't be made more robust without losing performance. Maybe cheap range checks can be done conditionally when _GLIBCXX_ASSERTIONS is defined, or maybe they'll be cheap enough to do unconditionally. Some work is needed to see what's feasible, but there's no reason to just close the request as INVALID.