AFAICT, the program below should run successfully to completion. $ cat -n u.cpp && g++ u.cpp -static && ./a.out 1 #include <cassert> 2 #include <sstream> 3 4 struct pubbuf: std::stringbuf { 5 using std::stringbuf::eback; 6 using std::stringbuf::egptr; 7 using std::stringbuf::pbase; 8 using std::stringbuf::pptr; 9 using std::stringbuf::epptr; 10 using std::stringbuf::overflow; 11 }; 12 13 int main () 14 { 15 struct: std::stringbuf { 16 using std::stringbuf::eback; 17 using std::stringbuf::egptr; 18 using std::stringbuf::pbase; 19 using std::stringbuf::pptr; 20 using std::stringbuf::epptr; 21 using std::stringbuf::overflow; 22 } buf; 23 24 // 27.7.1.1, p1 and 27.5.2.1, p1: 25 assert (0 == buf.pbase () && 0 == buf.pptr () && 0 == buf.epptr ()); 26 27 // 27.7.1.3, p5, bullet 1: 28 assert ('x' == buf.overflow ('x')); 29 30 // 27.7.1.3, p5, bullet 1 and 27.5.2.2.5, p1: 31 assert (1 == buf.pptr () - buf.pbase ()); 32 33 // not required but good for efficiency: 34 const int write_positions = buf.epptr () - buf.pbase (); 35 assert (1 < write_positions); 36 37 // 27.7.1.3, p8: 38 assert (write_positions == buf.egptr () - buf.eback ()); 39 } 40 Assertion failed: write_positions == buf.egptr () - buf.eback (), file u.cpp, line 38 Abort (core dumped)
-- Summary: stringbuf::overflow() fails to set egptr() same as epptr() Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26250