summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h76
2 files changed, 30 insertions, 53 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 81d4268594d..9708c9b31b2 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,12 @@
2005-10-05 Paolo Carlini <pcarlini@suse.de>
+ * include/ext/sso_string_base.h (struct __sso_string_local):
+ Remove, actually POD types cannot have user defined constructors
+ (being aggregates) and therefore can always be members of unions.
+ (class __sso_string_base): Adjust consistently.
+
+2005-10-05 Paolo Carlini <pcarlini@suse.de>
+
PR libstdc++/24198
* testsuite/27_io/basic_filebuf/3.cc: Use __gnu_test::pod_ushort
instead.
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index 6aceaba3c33..24bbae29add 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -38,44 +38,10 @@
namespace __gnu_cxx
{
- // N.B. According to 3.9/10 and 9/4, POD types can have user-defined
- // constructors: in that case, cannot be member of an union (9.5/1).
- // See, f.i., class gnu_char_type in the testsuite.
- template<typename _CharT, typename _Traits, typename _Alloc,
- bool = std::__is_scalar<_CharT>::__value>
- struct __sso_string_local
- {
- typedef typename __vstring_utility<_CharT, _Traits, _Alloc>::
- _CharT_alloc_type::size_type size_type;
-
- enum { _S_local_capacity = 15 };
-
- union
- {
- _CharT _M_local_data[_S_local_capacity + 1];
- size_type _M_allocated_capacity;
- };
- };
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- struct __sso_string_local<_CharT, _Traits, _Alloc, false>
- {
- typedef typename __vstring_utility<_CharT, _Traits, _Alloc>::
- _CharT_alloc_type::size_type size_type;
-
- enum { _S_local_capacity = 15 };
-
- _CharT _M_local_data[_S_local_capacity + 1];
- size_type _M_allocated_capacity;
- };
-
template<typename _CharT, typename _Traits, typename _Alloc>
class __sso_string_base
- : protected __vstring_utility<_CharT, _Traits, _Alloc>,
- private __sso_string_local<_CharT, _Traits, _Alloc>
+ : protected __vstring_utility<_CharT, _Traits, _Alloc>
{
- typedef __sso_string_local<_CharT, _Traits, _Alloc> _Local;
-
public:
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
@@ -100,25 +66,7 @@ namespace __gnu_cxx
private:
static const _CharT _S_terminal;
-
- using _Local::_S_local_capacity;
- using _Local::_M_local_data;
- using _Local::_M_allocated_capacity;
-
- // Create & Destroy
- _CharT*
- _M_create(size_type&, size_type);
- void
- _M_dispose() throw()
- {
- if (!_M_is_local())
- _M_destroy(_M_allocated_capacity + 1);
- }
-
- void
- _M_destroy(size_type) throw();
-
// Use empty-base optimization: http://www.cantrip.org/emptyopt.html
struct _Alloc_hider : _Alloc
{
@@ -132,6 +80,14 @@ namespace __gnu_cxx
_Alloc_hider _M_dataplus;
size_type _M_string_length;
+ enum { _S_local_capacity = 15 };
+
+ union
+ {
+ _CharT _M_local_data[_S_local_capacity + 1];
+ size_type _M_allocated_capacity;
+ };
+
_CharT*
_M_data(_CharT* __p)
{ return (_M_dataplus._M_p = __p); }
@@ -148,6 +104,20 @@ namespace __gnu_cxx
_M_is_local() const
{ return _M_data() == _M_local_data; }
+ // Create & Destroy
+ _CharT*
+ _M_create(size_type&, size_type);
+
+ void
+ _M_dispose() throw()
+ {
+ if (!_M_is_local())
+ _M_destroy(_M_allocated_capacity + 1);
+ }
+
+ void
+ _M_destroy(size_type) throw();
+
// _M_construct_aux is used to implement the 21.3.1 para 15 which
// requires special behaviour if _InIter is an integral type
template<class _InIterator>