This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/10095: istream::operator>>(int&) sets ios::badbit when ios::failbit is set.
- From: peturr02 at ru dot is
- To: gcc-gnats at gcc dot gnu dot org
- Date: 15 Mar 2003 10:44:04 -0000
- Subject: libstdc++/10095: istream::operator>>(int&) sets ios::badbit when ios::failbit is set.
- Reply-to: peturr02 at ru dot is
>Number: 10095
>Category: libstdc++
>Synopsis: istream::operator>>(int&) sets ios::badbit when ios::failbit is set.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 15 10:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: peturr02 at ru dot is
>Release: gcc-3.2.2
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
When ios::failbit is set in exceptions, ios::badbit will be set in rdstate() whenever basic_istream::operator>>(int&) sets ios::failbit in rdstate().
>How-To-Repeat:
See attachment.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="exceptionsbug3.cc"
Content-Disposition: inline; filename="exceptionsbug3.cc"
#include <sstream>
#undef NDEBUG
#include <cassert>
int main()
{
using namespace std;
istringstream stream("whatever");
stream.exceptions(ios::failbit);
try
{
int i;
stream >> i;
}
catch (ios::failure&)
{
}
assert(stream.rdstate() == ios::failbit);
return 0;
}