aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2012-03-08 01:05:01 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2012-03-08 01:05:01 +0000
commit8ad8655c6e8f1d2eaf6ed277a58623f06da27598 (patch)
tree9078460c3e36ce7ca7f882de86f456efa2ce9bc5
parent79bb38d3b5867cb4577b6acbfe7954288a54d28b (diff)
downloadgcc-8ad8655c6e8f1d2eaf6ed277a58623f06da27598.zip
gcc-8ad8655c6e8f1d2eaf6ed277a58623f06da27598.tar.gz
gcc-8ad8655c6e8f1d2eaf6ed277a58623f06da27598.tar.bz2
re PR libstdc++/52433 ([C++11] debug mode iterators need to move)
PR libstdc++/52433 * include/debug/safe_iterator.h (_Safe_iterator): Add debug checks to move constructor and move assignment operator. From-SVN: r185089
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h12
2 files changed, 17 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cf6d913..ce28ef1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-08 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/52433
+ * include/debug/safe_iterator.h (_Safe_iterator): Add debug checks
+ to move constructor and move assignment operator.
+
2012-03-05 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_algobase.h (iter_swap): In C++11 mode simply
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index 65dff55..6bb3cd2 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -1,6 +1,6 @@
// Safe iterator implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011
+// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -176,6 +176,11 @@ namespace __gnu_debug
*/
_Safe_iterator(_Safe_iterator&& __x) : _M_current()
{
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
+ _M_message(__msg_init_copy_singular)
+ ._M_iterator(*this, "this")
+ ._M_iterator(__x, "other"));
std::swap(_M_current, __x._M_current);
this->_M_attach(__x._M_sequence);
__x._M_detach();
@@ -229,6 +234,11 @@ namespace __gnu_debug
_Safe_iterator&
operator=(_Safe_iterator&& __x)
{
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
+ _M_message(__msg_copy_singular)
+ ._M_iterator(*this, "this")
+ ._M_iterator(__x, "other"));
_M_current = __x._M_current;
_M_attach(__x._M_sequence);
__x._M_detach();