libstdc++/10093: Regression: Setting failbit in exceptions doesn't work

peturr02@ru.is peturr02@ru.is
Sat Mar 15 10:56:00 GMT 2003


>Number:         10093
>Category:       libstdc++
>Synopsis:       Regression: Setting failbit in exceptions doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 15 10:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc version 3.3 20030310 (prerelease)
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
Setting ios_base::failbit in basic_ios::exceptions does not cause basic_istream::operator>>(int&) to throw an exception.

This appears to have been caused by the recent patch for PR libstdc++/9561.
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="exceptionsbug2.cc"
Content-Disposition: inline; filename="exceptionsbug2.cc"

#include <sstream>

#undef NDEBUG
#include <cassert>

int main()
{
	using namespace std;

	istringstream stream("whatever");
	stream.exceptions(ios::failbit);

	try
	{
		int i;
		stream >> i;
		assert(false);
	}
	catch (ios::failure&)
	{
	}

	return 0;
}



More information about the Gcc-bugs mailing list