https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86130
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- And they don't test for iostream operations failing? The program has undefined behaviour, i.e. a bug. Whether it's better to identify that and treat it as a corrupt stream state (setting badbit, and optionally throwing an exception) or crash the program depends on the program. There's no single choice that's correct for all programs.