2010-11-27 François Dumont <francois.cppdevs@free.fr>
* include/debug/bitset (bitset<>::reference): Clean code, use normal
reference type in experimental mode.
* testsuite/23_containers/bitset/debug/invalid/1.cc: Fix for
experimental mode.
From-SVN: r167196
+2010-11-27 François Dumont <francois.cppdevs@free.fr>
+
+ * include/debug/bitset (bitset<>::reference): Clean code, use normal
+ reference type in experimental mode.
+ * testsuite/23_containers/bitset/debug/invalid/1.cc: Fix for
+ experimental mode.
+
2010-11-26 François Dumont <francois.cppdevs@free.fr>
* testsuite/lib/libstdc++.exp ([check_v3_target_debug_mode]): Use
2010-11-26 François Dumont <francois.cppdevs@free.fr>
* testsuite/lib/libstdc++.exp ([check_v3_target_debug_mode]): Use
typedef _GLIBCXX_STD_D::bitset<_Nb> _Base;
public:
typedef _GLIBCXX_STD_D::bitset<_Nb> _Base;
public:
+ // In C++0x we rely on normal reference type to preserve the property
+ // of bitset to be use as a literal.
+ // TODO: Find an other solution.
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ typedef typename _Base::reference reference;
+#else
// bit reference:
class reference
: private _Base::reference
// bit reference:
class reference
: private _Base::reference
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
, public __gnu_debug::_Safe_iterator_base
, public __gnu_debug::_Safe_iterator_base
{
typedef typename _Base::reference _Base_ref;
{
typedef typename _Base::reference _Base_ref;
reference(const _Base_ref& __base,
bitset* __seq __attribute__((__unused__)))
: _Base_ref(__base)
reference(const _Base_ref& __base,
bitset* __seq __attribute__((__unused__)))
: _Base_ref(__base)
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
, _Safe_iterator_base(__seq, false)
, _Safe_iterator_base(__seq, false)
{ }
public:
reference(const reference& __x)
: _Base_ref(__x)
{ }
public:
reference(const reference& __x)
: _Base_ref(__x)
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
, _Safe_iterator_base(__x, false)
, _Safe_iterator_base(__x, false)
{ }
reference&
operator=(bool __x)
{
{ }
reference&
operator=(bool __x)
{
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write)
._M_iterator(*this));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write)
._M_iterator(*this));
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
reference&
operator=(const reference& __x)
{
reference&
operator=(const reference& __x)
{
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(__x));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write)
._M_iterator(*this));
_GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(__x));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write)
._M_iterator(*this));
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(*this));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(*this));
return ~(*static_cast<const _Base_ref*>(this));
}
operator bool() const
{
return ~(*static_cast<const _Base_ref*>(this));
}
operator bool() const
{
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(*this));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
._M_iterator(*this));
return *static_cast<const _Base_ref*>(this);
}
reference&
flip()
{
return *static_cast<const _Base_ref*>(this);
}
reference&
flip()
{
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_flip)
._M_iterator(*this));
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_flip)
._M_iterator(*this));
_Base_ref::flip();
return *this;
}
};
_Base_ref::flip();
return *this;
}
};
// 23.3.5.1 constructors:
_GLIBCXX_CONSTEXPR bitset() : _Base() { }
// 23.3.5.1 constructors:
_GLIBCXX_CONSTEXPR bitset() : _Base() { }
operator[](size_t __pos)
{
__glibcxx_check_subscript(__pos);
operator[](size_t __pos)
{
__glibcxx_check_subscript(__pos);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ return _M_base()[__pos];
+#else
return reference(_M_base()[__pos], this);
return reference(_M_base()[__pos], this);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
i = new bitset<32>::reference(bs[7]);
VERIFY(*i);
}
i = new bitset<32>::reference(bs[7]);
VERIFY(*i);
}
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
VERIFY(i->_M_singular());
VERIFY(i->_M_singular());