summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/debug/safe_iterator.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-04 13:01:08 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-04 13:01:08 +0000
commit6eb126395c70fa5164769f46cbe16c13125cf6ee (patch)
tree7809171cc49cbef0c3bf420c0c092104516ee65e /libstdc++-v3/include/debug/safe_iterator.h
parentda540712f976bae56ea70f78b5faae537ceaebdd (diff)
downloadppe42-gcc-6eb126395c70fa5164769f46cbe16c13125cf6ee.tar.gz
ppe42-gcc-6eb126395c70fa5164769f46cbe16c13125cf6ee.zip
2009-08-04 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/15523 * include/debug/safe_iterator.h (_Safe_iterator<>:: _Safe_iterator(const _Safe_iterator&), _Safe_iterator<>:: operator=(const _Safe_iterator&)): Implement resolution of DR 408, do not error out when the source is a value-initialized iterator. * testsuite/23_containers/vector/15523.cc: New. * doc/xml/manual/intro.xml: Add an entry for DR 408. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150455 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug/safe_iterator.h')
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index dbdb32e2299..eb0a3e4ae15 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -115,12 +115,14 @@ namespace __gnu_debug
/**
* @brief Copy construction.
- * @pre @p x is not singular
*/
_Safe_iterator(const _Safe_iterator& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
_M_message(__msg_init_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -129,8 +131,6 @@ namespace __gnu_debug
/**
* @brief Converting constructor from a mutable iterator to a
* constant iterator.
- *
- * @pre @p x is not singular
*/
template<typename _MutableIterator>
_Safe_iterator(
@@ -140,7 +140,10 @@ namespace __gnu_debug
_Sequence>::__type>& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x.base() == _Iterator(),
_M_message(__msg_init_const_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -148,12 +151,14 @@ namespace __gnu_debug
/**
* @brief Copy assignment.
- * @pre @p x is not singular
*/
_Safe_iterator&
operator=(const _Safe_iterator& __x)
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
_M_message(__msg_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -169,7 +174,6 @@ namespace __gnu_debug
reference
operator*() const
{
-
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref)
._M_iterator(*this, "this"));
OpenPOWER on IntegriCloud