Not a bug: std::hex, _not_std::ios::hex, otherwise you are printing the value of the flags. Thanks, Paolo. P.S. As for p. 622 of Josuttis, the correction is in the latest Errata ;) http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9644