]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/12657 (Resolution of DR 292 (WP) still unimplemented)
authorPaolo Carlini <pcarlini@suse.de>
Thu, 29 Jan 2004 10:44:04 +0000 (10:44 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 29 Jan 2004 10:44:04 +0000 (10:44 +0000)
2004-01-29  Paolo Carlini  <pcarlini@suse.de>

PR libstdc++/12657
* include/bits/basic_ios.tcc (copyfmt(const basic_ios&)):
Implement resolution of DR 292 (WP).

From-SVN: r76856

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_ios.tcc

index a1caca77c1f43ab6a6d62f77fdc10dd2232d10d1..fed0a597f1d1d6fdb553dd6a7721eef8cd5934fe 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-29  Paolo Carlini  <pcarlini@suse.de>
+       
+       PR libstdc++/12657
+       * include/bits/basic_ios.tcc (copyfmt(const basic_ios&)):
+       Implement resolution of DR 292 (WP).
+
 2004-01-28  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/13369
index 1c9cd3b7256a7a3056d0d28bc180a7cfd00998b3..bbff2f5ca24e892cc3b7d8bcd4f33a5dbc7c6bc9 100644 (file)
@@ -60,52 +60,56 @@ namespace std
     basic_ios<_CharT, _Traits>&
     basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
     {
-      // Per 27.1.1.1, do not call imbue, yet must trash all caches
-      // associated with imbue()
-
-      // Alloc any new word array first, so if it fails we have "rollback".
-      _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
-       _M_local_word : new _Words[__rhs._M_word_size];
-
-      // Bump refs before doing callbacks, for safety.
-      _Callback_list* __cb = __rhs._M_callbacks;
-      if (__cb) 
-       __cb->_M_add_reference();
-      _M_call_callbacks(erase_event);
-      if (_M_word != _M_local_word) 
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 292. effects of a.copyfmt (a)
+      if (this != &__rhs)
        {
-         delete [] _M_word;
-         _M_word = 0;
+         // Per 27.1.1.1, do not call imbue, yet must trash all caches
+         // associated with imbue()
+
+         // Alloc any new word array first, so if it fails we have "rollback".
+         _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
+           _M_local_word : new _Words[__rhs._M_word_size];
+
+         // Bump refs before doing callbacks, for safety.
+         _Callback_list* __cb = __rhs._M_callbacks;
+         if (__cb) 
+           __cb->_M_add_reference();
+         _M_call_callbacks(erase_event);
+         if (_M_word != _M_local_word) 
+           {
+             delete [] _M_word;
+             _M_word = 0;
+           }
+         _M_dispose_callbacks();
+         
+         _M_callbacks = __cb;  // NB: Don't want any added during above.
+         for (int __i = 0; __i < __rhs._M_word_size; ++__i)
+           __words[__i] = __rhs._M_word[__i];
+         if (_M_word != _M_local_word) 
+           {
+             delete [] _M_word;
+             _M_word = 0;
+           }
+         _M_word = __words;
+         _M_word_size = __rhs._M_word_size;
+         
+         this->flags(__rhs.flags());
+         this->width(__rhs.width());
+         this->precision(__rhs.precision());
+         this->tie(__rhs.tie());
+         this->fill(__rhs.fill());
+         _M_ios_locale = __rhs.getloc();
+         
+         // This removes the link to __rhs locale cache
+         _M_call_callbacks(copyfmt_event);
+         
+         _M_cache_locale(_M_ios_locale);
+         
+
+         // The next is required to be the last assignment.
+         this->exceptions(__rhs.exceptions());
        }
-      _M_dispose_callbacks();
-
-      _M_callbacks = __cb;  // NB: Don't want any added during above.
-      for (int __i = 0; __i < __rhs._M_word_size; ++__i)
-       __words[__i] = __rhs._M_word[__i];
-      if (_M_word != _M_local_word) 
-       {
-         delete [] _M_word;
-         _M_word = 0;
-       }
-      _M_word = __words;
-      _M_word_size = __rhs._M_word_size;
-
-      this->flags(__rhs.flags());
-      this->width(__rhs.width());
-      this->precision(__rhs.precision());
-      this->tie(__rhs.tie());
-      this->fill(__rhs.fill());
-      _M_ios_locale = __rhs.getloc();
-
-      // This removes the link to __rhs locale cache
-      _M_call_callbacks(copyfmt_event);
-
-      _M_cache_locale(_M_ios_locale);
-
-
-      // The next is required to be the last assignment.
-      this->exceptions(__rhs.exceptions());
-      
       return *this;
     }