https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115432
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- In case output_stream is not the same or derived from file_output_stream or contains a file_output_stream object as first member you invoke undefined behavior when the calls following might read from the object via output_stream or another alltogether different type (buffer_output_stream?).