27.6.1.1 P4 says that formatted input functions should set badbit if a call to fetch characters from the streambuf throws an exception.
The implementation of this in bits/istream.tcc is done after the sentry is constructed. But the sentry's constructor may try to read whitespace, and it is not doing any exception handling, so ios_base::badbit is not getting set in this case. -- Summary: std::basic_istream<>::sentry() fails to catch when reading whitespace Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jimrees at itasoftware dot com GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: x86_64-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026