basic_string.tcc (_Rep::_S_create): Call _M_set_sharable() for backwards compatibility.
authorJakub Jelinek <jakub@redhat.com>
Mon, 16 Oct 2006 09:51:14 +0000 (11:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 16 Oct 2006 09:51:14 +0000 (11:51 +0200)
* include/bits/basic_string.tcc (_Rep::_S_create): Call
_M_set_sharable() for backwards compatibility.

From-SVN: r117777

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

index 0fa59dd3debe68b5558f6ed17810809e832705f0..0aed5e0f8a7423f8cb8175fb96030bab9a1cd3ce 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * include/bits/basic_string.tcc (_Rep::_S_create): Call
+       _M_set_sharable() for backwards compatibility.
+
 2006-10-15  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/istream.tcc (getline(basic_istream<>&,
index 4cf5f29ad36dbb47ff940081e29fefcc72a31290..fadf9b34ea138c880a1ac80c6134b559bc97059c 100644 (file)
@@ -588,6 +588,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);
       _Rep *__p = new (__place) _Rep;
       __p->_M_capacity = __capacity;
+      // ABI compatibility - 3.4.x set in _S_create both
+      // _M_refcount and _M_length.  All callers of _S_create
+      // in basic_string.tcc then set just _M_length.
+      // In 4.0.x and later both _M_refcount and _M_length
+      // are initialized in the callers, unfortunately we can
+      // have 3.4.x compiled code with _S_create callers inlined
+      // calling 4.0.x+ _S_create.
+      __p->_M_set_sharable();
       return __p;
     }