This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [FYI] Forward movement on 9404
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, Nathan Myers <ncm at cantrip dot org>
- Date: Sat, 22 Feb 2003 00:36:00 +0100
- Subject: Re: [FYI] Forward movement on 9404
- References: <3E56B31D.3050003@unitus.it>
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;
}