Commit 9fdcbf40 by Jonathan Wakely Committed by Jonathan Wakely

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
parent 7c45393e
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.
......
......@@ -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__));
......
// { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment