ios.cc (ios_base::_M_init): Remove _M_word_size.
authorJerry Quinn <jlquinn@optonline.net>
Thu, 6 Mar 2003 18:10:26 +0000 (18:10 +0000)
committerJerry Quinn <jlquinn@gcc.gnu.org>
Thu, 6 Mar 2003 18:10:26 +0000 (18:10 +0000)
2003-03-06  Jerry Quinn  <jlquinn@optonline.net>

* src/ios.cc (ios_base::_M_init): Remove _M_word_size.
(ios_base::ios_base): Set _M_word, _M_word_size.
(ios_base::~ios_base): Remove redundant test.
* testsuite/27_io/ios_base_storage.cc (test03): New.

From-SVN: r63896

libstdc++-v3/ChangeLog
libstdc++-v3/src/ios.cc
libstdc++-v3/testsuite/27_io/ios_base_storage.cc

index ef9b41f0cd5f2dda7adb17f07d56378c1e49ea75..965a33302df7730ecb4d16b3feb23461e7d2f96c 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-06  Jerry Quinn  <jlquinn@optonline.net>
+
+       * src/ios.cc (ios_base::_M_init): Remove _M_word_size.
+       (ios_base::ios_base): Set _M_word, _M_word_size.
+       (ios_base::~ios_base): Remove redundant test.
+       * testsuite/27_io/ios_base_storage.cc (test03): New.
+
 2003-03-04  Alexandre Oliva  <aoliva@redhat.com>
 
        * src/strstream.cc, include/bits/basic_string.tcc: Remove
index 871e836ae9e72fe6cecbc51dbcef8867ddaaba85..f068a2993619cea8fb3ae5329f87e51c8dd27494 100644 (file)
@@ -288,7 +288,6 @@ namespace std
     _M_width = 0;
     _M_flags = skipws | dec;
     _M_callbacks = 0;
-    _M_word_size = 0;
     _M_ios_locale = locale();
   }  
   
@@ -302,7 +301,8 @@ namespace std
     return __old;
   }
 
-  ios_base::ios_base() : _M_callbacks(0), _M_word(0), _M_locale_cache(0)
+  ios_base::ios_base() : _M_callbacks(0), _M_word(_M_local_word),
+                        _M_word_size(_S_local_word_size), _M_locale_cache(0)
   {
     // Do nothing: basic_ios::init() does it.  
     // NB: _M_callbacks and _M_word must be zero for non-initialized
@@ -314,7 +314,7 @@ namespace std
   {
     _M_call_callbacks(erase_event);
     _M_dispose_callbacks();
-    if (_M_word && _M_word != _M_local_word) 
+    if (_M_word != _M_local_word) 
       {
        delete [] _M_word;
        _M_word = 0;
index a0c174660c4722bab50f1ce749da468e3ed99243..6af52c0a8c076ec512b7ef6011dcc1ef89cbf486 100644 (file)
@@ -91,10 +91,25 @@ void test02()
   VERIFY( l == 0 );
 }
 
+class derived : public std::ios_base
+{
+public:
+  derived() {}
+};
+
+void test03()
+{
+  derived d;
+
+  d.pword(0) = &d;
+  d.iword(0) = 1;
+}
+
 int main(void)
 {
   __gnu_cxx_test::set_memory_limits();
   test01();
   test02();
+  test03();
   return 0;
 }