https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69877
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Leo Carreon from comment #1) > In addition, if I comment out the line: > > vStream.exceptions(std::ios_base::badbit); > > The executable does not core dump. Yes, obviously. If you don't ask the stream to throw an exception when the badbit is set in the stream's state, then it won't throw an exception when you set the badbit.