std::ostream::operator<<(int) fails to call width(0) on exception
-----------------------------------------------------------------
Key: STDCXX-259
URL: http://issues.apache.org/jira/browse/STDCXX-259
Project: C++ Standard Library
Type: Bug
Components: 27. Input/Output
Versions: 4.1.2, 4.1.3
Environment: all
Reporter: Martin Sebor
Assigned to: Martin Sebor
lib.facet.num.put.virtuals, p5, Stage 3 is specified to end by the facet
calling width(0) before outputting any characters using the facet's iterator.
The program below shows that stdcxx fails to do so:
$ cat t.cpp && nice gmake t && ./t
#include <cassert>
#include <ostream>
#include <streambuf>
int main ()
{
struct: std::streambuf {
int_type overflow (int_type) {
return throw this, traits_type::eof ();
}
} buf;
std::ostream out (&buf);
out.width (2);
try {
out << 1;
}
catch (...) { }
assert (0 == out.width ());
}
aCC -c -I/nfs/devco/sebor/dev/stdlib/include/ansi -I/usr/include -D_RWSTDDEBUG
-D_RWSTD_USE_CONFIG -I/nfs/devco/sebor/dev/stdlib/include
-I/build/sebor/aCC-3.27-11s/include
-I/nfs/devco/sebor/dev/stdlib/examples/include -Aa +nostl -g +d +w +W392
+W655 +W684 +W818 +W819 +W849 +W229 +W361 t.cpp
aCC t.o -o t -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings
-L/build/sebor/aCC-3.27-11s/lib -L/build/sebor/aCC-3.27-11s/lib -lstd11s
-lm
Assertion failed: 0 == out.width (), file t.cpp, line 20
ABORT instruction (core dumped)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira