Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.2.1
-
None
-
Incorrect Behavior
Description
This bug was uncovered in this discussion :
$ cat t.cpp && make t && ./t #include <cassert> #include <istream> #include <streambuf> int main () { static int x = '0'; struct: std::streambuf { // unbuffered, always successfully reads one character int_type underflow () { return x++; } } sb; // "endless" stream that never reaches EOF std::istream endless (&sb); char s [4] = ""; endless.read (s, sizeof s); // expect to extract as many characters as requested assert (endless.good ()); assert (sizeof s == endless.gcount ()); assert ('0' == s [0] && '1' == s [1] && '2' == s [2] && '3' == s [3]); } gcc -c -I/home/sebor/stdcxx-4.2.1/include/ansi \ -I/home/sebor/stdcxx-4.2.1/include \ -I/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/include \ -I/home/sebor/stdcxx-4.2.1/examples/include \ -pedantic -nostdinc++ -O2 -W -Wall \ -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp t.cpp: In function 'int main()': t.cpp:9: warning: inlining failed in call to 'virtual main()::<anonymous struct>::~._26()': call is unlikely and code size would grow t.cpp:24: warning: called from here t.cpp:9: warning: inlining failed in call to 'virtual main()::<anonymous struct>::~._26()': call is unlikely and code size would grow t.cpp:24: warning: called from here gcc t.o -o t -L/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/lib -Wl,-R/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/lib -lstd8D -lsupc++ -lm t: t.cpp:22: int main(): Assertion `endless.good ()' failed. Aborted