This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [FYI] Forward movement on 9404


I sent the wrong testcase. Sorry.
This one is really 9404, and passes, of course ;)

Paolo.

/////////
--- stringbuf_virtuals.cc.orig	2003-02-22 00:32:30.000000000 +0100
+++ stringbuf_virtuals.cc.new	2003-02-22 00:32:16.000000000 +0100
@@ -92,6 +92,46 @@
   VERIFY( ob.getloc() == loc_de );
 }
 
+bool called = false;
+
+class Derived_stringbuf : public std::stringbuf
+{
+public:
+  int_type overflow(int_type c)
+  {
+    called = true;
+    return std::stringbuf::overflow(c);
+  }
+  
+  const char_type* pub_epptr() const
+  {
+    return epptr();
+  }
+  
+  const char_type* pub_pptr() const
+  {
+    return pptr();
+  }
+};
+
+// libstdc++/9404
+void test09()
+{
+  bool test = true;
+
+  Derived_stringbuf dsbuf;
+  dsbuf.sputc('s');
+  VERIFY( called );
+  VERIFY( dsbuf.pub_epptr() != dsbuf.pub_pptr() );
+  
+  called = false;
+  dsbuf.sputc('i');
+  VERIFY( !called );
+
+  dsbuf.sputc('l');
+  VERIFY( dsbuf.str() == "sil" );
+}
+
 int main() 
 {
   using namespace std;
@@ -106,5 +146,6 @@
   test02(in3, false);
 
   test08();
+  test09();
   return 0;
 }

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