aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2009-06-16 21:24:41 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2009-06-16 22:24:41 +0100
commit9fdcbf40319a526845c586ac2ca147bb5ee53286 (patch)
tree1e8c161c7569e19a69714ac9053448401d320250
parent7c45393e40d63f23b2691285d5ed450ce4fb5389 (diff)
downloadgcc-9fdcbf40319a526845c586ac2ca147bb5ee53286.zip
gcc-9fdcbf40319a526845c586ac2ca147bb5ee53286.tar.gz
gcc-9fdcbf40319a526845c586ac2ca147bb5ee53286.tar.bz2
exception_ptr.h (exception_ptr::swap(exception_ptr&&)): Remove.
2009-06-16 Jonathan Wakely <jwakely.gcc@gmail.com> * libsupc++/exception_ptr.h (exception_ptr::swap(exception_ptr&&)): Remove. (exception_ptr::operator=(exception_ptr&&)): Cast source to rvalue-reference so that move constructor is called. * testsuite/18_support/exception_ptr/move.cc: New. From-SVN: r148555
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h12
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/move.cc45
3 files changed, 54 insertions, 11 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7d17880..03c0110 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,13 @@
2009-06-16 Jonathan Wakely <jwakely.gcc@gmail.com>
+ * libsupc++/exception_ptr.h (exception_ptr::swap(exception_ptr&&)):
+ Remove.
+ (exception_ptr::operator=(exception_ptr&&)): Cast source to
+ rvalue-reference so that move constructor is called.
+ * testsuite/18_support/exception_ptr/move.cc: New.
+
+2009-06-16 Jonathan Wakely <jwakely.gcc@gmail.com>
+
* include/std/thread (~thread(), operator=(thread&&)): Call terminate
if joinable.
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 37f3132..23477c9 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -123,7 +123,7 @@ namespace std
exception_ptr&
operator=(exception_ptr&& __o) throw()
{
- exception_ptr(__o).swap(*this);
+ exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
return *this;
}
#endif
@@ -133,16 +133,6 @@ namespace std
void
swap(exception_ptr&) throw();
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- void
- swap(exception_ptr &&__o) throw()
- {
- void *__tmp = _M_exception_object;
- _M_exception_object = __o._M_exception_object;
- __o._M_exception_object = __tmp;
- }
-#endif
-
#ifdef _GLIBCXX_EH_PTR_COMPAT
// Retained for compatibility with CXXABI_1.3.
bool operator!() const throw() __attribute__ ((__pure__));
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
new file mode 100644
index 0000000..ce97bc2
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <exception>
+#include <utility>
+#include <testsuite_hooks.h>
+
+// Verify move construction and assignment are efficient and do not copy.
+// This behaviour is a GNU extension provided for efficiency.
+void test01()
+{
+ bool test = true;
+
+ std::exception_ptr p1 = std::copy_exception(test);
+ std::exception_ptr p2 = std::move(p1);
+ VERIFY( p1 == 0 );
+ VERIFY( !(p2 == 0) );
+
+ p1 = std::move(p2);
+ VERIFY( !(p1 == 0) );
+ VERIFY( p2 == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}