summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-18 22:15:56 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-18 22:15:56 +0000
commit719b78cdb49c55d984994b548ce89a10a8cfe65f (patch)
tree9e5d3130d10e286ff2c08e48302f54620ec6707d /libstdc++-v3/testsuite
parentcf7aa2e51ccf96bec610fc41b4d6f6c71a5d1ad8 (diff)
downloadgcc-719b78cdb49c55d984994b548ce89a10a8cfe65f.tar.gz
2009-05-18 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/stl_pair.h (swap): Do not swap rvalues. * include/bits/stl_deque.h (swap): Likewise. * include/bits/stl_list.h (swap): Likewise. * include/bits/stl_vector.h (swap): Likewise. * include/bits/stl_bvector.h (swap): Likewise. * include/bits/stl_queue.h (swap): Likewise. * include/bits/stl_stack.h (swap): Likewise. * include/bits/stl_tree.h (swap): Likewise. * include/bits/stl_map.h (swap): Likewise. * include/bits/stl_multimap.h (swap): Likewise. * include/bits/stl_set.h (swap): Likewise. * include/bits/stl_multiset.h (swap): Likewise. * include/bits/forward_list.h (swap): Likewise. * include/bits/unique_ptr.h (swap): Likewise. * include/debug/deque (swap): Likewise. * include/debug/list (swap): Likewise. * include/debug/vector (swap): Likewise. * include/debug/map.h (swap): Likewise. * include/debug/multimap.h (swap): Likewise. * include/debug/set.h (swap): Likewise. * include/debug/multiset.h (swap): Likewise. * include/debug/unordered_map (swap): Likewise. * include/debug/unordered_set (swap): Likewise. * include/ext/vstring.h (swap): Likewise. * include/tr1_impl/unordered_map (swap): Likewise. * include/tr1_impl/hashtable (swap): Likewise. * include/tr1_impl/unordered_set (swap): Likewise. * include/std/tuple (swap): Likewise. * include/std/mutex (swap): Likewise. * include/std/thread (swap): Likewise. (operator<<): Only output to lvalue streams. * testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc: Remove. * testsuite/23_containers/headers/forward_list/synopsis.cc: Adjust. * testsuite/23_containers/deque/requirements/dr438/ assign_neg.cc: Adjust line numbers. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/30_threads/thread/swap/1.cc: Swap with lvalue and also test non-member swap. * testsuite/30_threads/thread/swap/2.cc: Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147678 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/swap/1.cc39
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/swap/2.cc112
16 files changed, 48 insertions, 180 deletions
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc
deleted file mode 100644
index 0ace59b1cc7..00000000000
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// { dg-options "-std=gnu++0x" }
-// { dg-do compile }
-
-// Copyright (C) 2008, 2009 Free Software Foundation
-//
-// 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/>.
-
-// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
-
-#include <memory>
-#include <testsuite_hooks.h>
-
-struct A { };
-
-// 20.7.12.2.4 shared_ptr modifiers [util.smartptr.shared.mod]
-
-// swap
-int
-test01()
-{
- bool test __attribute__((unused)) = true;
-
- std::shared_ptr<A> p(new A);
- p.swap(std::shared_ptr<A>(new A));
-
- return 0;
-}
-
-int
-main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 9ec59fe693e..f7439944837 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1498 }
+// { dg-error "no matching" "" { target *-*-* } 1494 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index 3bccae48034..b1136f59cf7 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1437 }
+// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 3c401f1241e..8752a7e7b10 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1437 }
+// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 2e812d0a840..8cf322e8219 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1582 }
+// { dg-error "no matching" "" { target *-*-* } 1578 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
index 759cea86fee..21d80cbb24b 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
@@ -43,10 +43,4 @@ namespace std {
template <class T, class Allocator>
void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y);
-
- template <class T, class Allocator>
- void swap(forward_list<T,Allocator>&& x, forward_list<T,Allocator>& y);
-
- template <class T, class Allocator>
- void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>&& y);
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index a32840fe859..e3c86f4056b 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1383 }
+// { dg-error "no matching" "" { target *-*-* } 1379 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index f8ab970a0dc..ef268014e2f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1352 }
+// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index 56460a2faa5..41280156344 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1352 }
+// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index 9c4aba66d37..f16fcfb2af3 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1352 }
+// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index 9cf809b63b8..5bff1fec07b 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1051 }
+// { dg-error "no matching" "" { target *-*-* } 1047 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index 42b538599c1..a50f5226c07 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 991 }
+// { dg-error "no matching" "" { target *-*-* } 987 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index 5d2b1558cab..a871cec9b56 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 991 }
+// { dg-error "no matching" "" { target *-*-* } 987 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 89b020b588f..d079335f7ae 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1092 }
+// { dg-error "no matching" "" { target *-*-* } 1088 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc
index a30bf5129e9..2a820ad0799 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc
@@ -30,21 +30,48 @@
void f() { }
-int main()
+void test01()
{
bool test __attribute__((unused)) = true;
- try
+ try
{
std::thread t1(f);
std::thread::id t1_id = t1.get_id();
std::thread t2;
- t2.swap(std::move(t1));
+ t2.swap(t1);
VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id );
+
+ t2.join();
+ }
+ catch (const std::system_error&)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ std::thread t1(f);
+ std::thread::id t1_id = t1.get_id();
+
+ std::thread t2;
+ std::swap(t1, t2);
+ VERIFY( t1.get_id() == std::thread::id() );
+ VERIFY( t2.get_id() == t1_id );
+
t2.join();
}
catch (const std::system_error&)
@@ -55,6 +82,12 @@ int main()
{
VERIFY( false );
}
+}
+
+int main()
+{
+ test01();
+ test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/30_threads/thread/swap/2.cc b/libstdc++-v3/testsuite/30_threads/thread/swap/2.cc
deleted file mode 100644
index 62e6651f7d6..00000000000
--- a/libstdc++-v3/testsuite/30_threads/thread/swap/2.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
-// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
-// { dg-require-cstdint "" }
-// { dg-require-gthreads "" }
-
-// Copyright (C) 2008, 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 <thread>
-#include <system_error>
-#include <bits/move.h> // std::move
-#include <testsuite_hooks.h>
-
-void f() { }
-
-void test01()
-{
- try
- {
- std::thread t1(f);
- std::thread::id t1_id = t1.get_id();
-
- std::thread t2;
- std::swap(t1, t2);
-
- VERIFY( t1.get_id() == std::thread::id() );
- VERIFY( t2.get_id() == t1_id );
-
- t2.join();
- }
- catch (const std::system_error&)
- {
- VERIFY( false );
- }
- catch (...)
- {
- VERIFY( false );
- }
-}
-
-void test02()
-{
- try
- {
- std::thread t1(f);
- std::thread::id t1_id = t1.get_id();
-
- std::thread t2;
- std::swap(std::move(t1), t2);
-
- VERIFY( t2.get_id() == t1_id );
-
- t2.join();
- }
- catch (const std::system_error&)
- {
- VERIFY( false );
- }
- catch (...)
- {
- VERIFY( false );
- }
-}
-
-void test03()
-{
- try
- {
- std::thread t1(f);
- std::thread::id t1_id = t1.get_id();
-
- std::thread t2;
- std::swap(t2, std::move(t1));
-
- VERIFY( t2.get_id() == t1_id );
-
- t2.join();
- }
- catch (const std::system_error&)
- {
- VERIFY( false );
- }
- catch (...)
- {
- VERIFY( false );
- }
-}
-
-int main()
-{
- test01();
- test02();
- test03();
- return 0;
-}