This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/10095: istream::operator>>(int&) sets ios::badbit when ios::failbit is set.


>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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]