diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a71f9341c98..1a589dda0da 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2009-06-23 Jonathan Wakely + + * include/bits/shared_ptr.h: Do not swap rvalues. + * testsuite/20_util/owner_less/cmp.cc: Add missing test variables. + * testsuite/20_util/shared_ptr/comparison/cmp.cc: Likewise. + * testsuite/20_util/shared_ptr/comparison/less.cc: Likewise. + * testsuite/20_util/weak_ptr/observers/owner_before.cc: Likewise. + * testsuite/20_util/tuple/swap.cc: Likewise. + 2009-06-23 Jonathan Wakely * include/debug/macros.h: Replace @tbd with valid doxygen tag @todo. diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index c7a45f39bc1..81bef585940 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -828,7 +828,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return _M_refcount._M_get_use_count(); } void - swap(__shared_ptr<_Tp, _Lp>&& __other) // never throws + swap(__shared_ptr<_Tp, _Lp>& __other) // never throws { std::swap(_M_ptr, __other._M_ptr); _M_refcount._M_swap(__other._M_refcount); @@ -938,16 +938,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) { __a.swap(__b); } - template - inline void - swap(__shared_ptr<_Tp, _Lp>&& __a, __shared_ptr<_Tp, _Lp>& __b) - { __a.swap(__b); } - - template - inline void - swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>&& __b) - { __a.swap(__b); } - // 2.2.3.9 shared_ptr casts /** @warning The seemingly equivalent * shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) @@ -1367,16 +1357,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) { __a.swap(__b); } - template - inline void - swap(shared_ptr<_Tp>&& __a, shared_ptr<_Tp>& __b) - { __a.swap(__b); } - - template - inline void - swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>&& __b) - { __a.swap(__b); } - // 20.8.13.2.10 shared_ptr casts. template inline shared_ptr<_Tp> diff --git a/libstdc++-v3/testsuite/20_util/owner_less/cmp.cc b/libstdc++-v3/testsuite/20_util/owner_less/cmp.cc index 440ac76a7a1..e1524cc1851 100644 --- a/libstdc++-v3/testsuite/20_util/owner_less/cmp.cc +++ b/libstdc++-v3/testsuite/20_util/owner_less/cmp.cc @@ -32,16 +32,18 @@ struct B { A a[2]; }; int test01() { - // test empty shared_ptrs compare equivalent - std::owner_less> less; - std::owner_less> wless; - std::shared_ptr p1; - std::shared_ptr p2; - VERIFY( !less(p1, p2) && !less(p2, p1) ); - std::weak_ptr p3; - VERIFY( !less(p1, p3) && !less(p3, p1) ); - VERIFY( !wless(p1, p3) && !wless(p3, p1) ); - return 0; + bool test __attribute__((unused)) = true; + + // test empty shared_ptrs compare equivalent + std::owner_less> less; + std::owner_less> wless; + std::shared_ptr p1; + std::shared_ptr p2; + VERIFY( !less(p1, p2) && !less(p2, p1) ); + std::weak_ptr p3; + VERIFY( !less(p1, p3) && !less(p3, p1) ); + VERIFY( !wless(p1, p3) && !wless(p3, p1) ); + return 0; } @@ -49,6 +51,8 @@ test01() int test02() { + bool test __attribute__((unused)) = true; + std::owner_less> less; std::owner_less> wless; @@ -80,6 +84,8 @@ test02() int test03() { + bool test __attribute__((unused)) = true; + std::owner_less> less; std::owner_less> wless; @@ -102,6 +108,8 @@ test03() int test04() { + bool test __attribute__((unused)) = true; + std::owner_less> less; std::shared_ptr a[3]; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc index 3e9db75802c..9991fa761bc 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc @@ -36,13 +36,15 @@ struct B : A int test01() { - // test empty shared_ptrs compare equivalent - std::shared_ptr p1; - std::shared_ptr p2; - VERIFY( p1 == p2 ); - VERIFY( !(p1 != p2) ); - VERIFY( !(p1 < p2) && !(p2 < p1) ); - return 0; + bool test __attribute__((unused)) = true; + + // test empty shared_ptrs compare equivalent + std::shared_ptr p1; + std::shared_ptr p2; + VERIFY( p1 == p2 ); + VERIFY( !(p1 != p2) ); + VERIFY( !(p1 < p2) && !(p2 < p1) ); + return 0; } @@ -50,6 +52,8 @@ test01() int test02() { + bool test __attribute__((unused)) = true; + std::shared_ptr A_default; std::shared_ptr A_from_A(new A); @@ -78,6 +82,8 @@ test02() int test03() { + bool test __attribute__((unused)) = true; + std::shared_ptr p1; // check other operators are defined diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc index 7f35dbe80d5..b51b222a028 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc @@ -41,6 +41,8 @@ namespace std int test01() { + bool test __attribute__((unused)) = true; + std::less> less; // test empty shared_ptrs compare equivalent std::shared_ptr p1; @@ -55,6 +57,8 @@ test01() int test02() { + bool test __attribute__((unused)) = true; + std::less> less; std::shared_ptr empty; @@ -77,6 +81,8 @@ test02() int test03() { + bool test __attribute__((unused)) = true; + std::less> less; A a; diff --git a/libstdc++-v3/testsuite/20_util/tuple/swap.cc b/libstdc++-v3/testsuite/20_util/tuple/swap.cc index 1e65f0521cb..6dab446bfe9 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/swap.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/swap.cc @@ -56,6 +56,8 @@ make_move_only (int i) void test01() { + bool test __attribute__((unused)) = true; + std::tuple<> t1, t2; std::swap(t1, t2); diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/observers/owner_before.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/observers/owner_before.cc index 786e7eb169e..1081f93d338 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/observers/owner_before.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/observers/owner_before.cc @@ -30,6 +30,8 @@ struct B { }; int test01() { + bool test __attribute__((unused)) = true; + // test empty weak_ptrs compare equivalent std::weak_ptr p1; std::weak_ptr p2; @@ -45,6 +47,8 @@ test01() int test02() { + bool test __attribute__((unused)) = true; + std::shared_ptr a0; std::weak_ptr w0(a0);