https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113159
--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Yury Gribov from comment #19) > (In reply to Jonathan Wakely from comment #17) > > That's what _GLIBCXX_DEBUG and/or _GLIBCXX_ASSERTIONS are for. > > I'm not sure they solve the issue I'm not saying they solve it today. I'm saying that "I want my mistake to be caught and diagnosed immediately" is the job of debugging assertions. > In general, why avoiding std::sort crashes is considered a good thing? Because a crash is not guaranteed, you might get incorrect results, memory corruption, information leaks, arbitrary code exeutions, security exploits etc. etc. Just crashing is almost the best case for undefined behaviour. Much worse things can happen.