]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
noexcept.cc: Change to compile-only test.
authorJonathan Wakely <jwakely.gcc@gmail.com>
Tue, 19 Nov 2013 22:03:30 +0000 (22:03 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 19 Nov 2013 22:03:30 +0000 (22:03 +0000)
* testsuite/23_containers/forward_list/allocator/noexcept.cc: Change
to compile-only test. Adjust swap overload to handle rebound
allocators.
* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/vector/allocator/swap.cc: Add elements
before swapping.

From-SVN: r205056

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/23_containers/forward_list/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/map/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/multimap/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/multiset/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/set/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_set/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/vector/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/vector/allocator/swap.cc

index 946b67f8cfc264538b9083c7a2dd12375253b6c5..27629f9c59d2528e1b4c2751dfb8be35c2ddac08 100644 (file)
@@ -1,3 +1,24 @@
+2013-11-19  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       * testsuite/23_containers/forward_list/allocator/noexcept.cc: Change
+       to compile-only test. Adjust swap overload to handle rebound
+       allocators.
+       * testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
+       * testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
+       * testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
+       * testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
+       * testsuite/23_containers/unordered_map/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_set/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
+       * testsuite/23_containers/vector/allocator/swap.cc: Add elements
+       before swapping.
+
 2013-11-19  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/experimental/string_view (_S_max_size): Remove.
index 0ee16705a91a3b1fb48779a13698c427c4d1dbfa..635fb77bec5421bbe0419bd82f55ded96bfc45b0 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++0x" }
 
 #include <forward_list>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -64,13 +62,5 @@ void test03()
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
-  // static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
-}
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
+  static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
index 832a28ab63a71782cc59fcfd2f7b8c212a303d32..4bd3f5755aa97e2b870cc88239bad5bdddf05bf8 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++11" }
 
 #include <map>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -31,14 +31,11 @@ struct U { };
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<std::pair<const T, U>, true>& l,
-       propagating_allocator<std::pair<const T, U>, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<std::pair<const T, U>> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -73,11 +70,3 @@ void test03()
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
   static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
-}
index aee4dc90029fcf4efea16824064dddc2eac9e2c8..9913acb863296928908b67b13d598df281b1e08e 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++11" }
 
 #include <map>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -31,14 +31,11 @@ struct U { };
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<std::pair<const T, U>, true>& l,
-       propagating_allocator<std::pair<const T, U>, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<std::pair<const T, U>> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -73,11 +70,3 @@ void test03()
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
   static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
-}
index 89b0053d4c2a39abb242491cde9811cd2d0a3bcb..d429313d5871b5ed6f7d0711b1d10b977acb580a 100644 (file)
@@ -15,6 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++11" }
 
 #include <set>
@@ -29,14 +30,11 @@ using Cmp = std::less<T>;
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l,
-       propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -71,11 +69,3 @@ void test03()
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
   static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
-}
index 07adbc08013e2adf026c3b17c5d56aa56b166e4d..f8389d6a42f7799db991261ae71f7ac4274b7244 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++11" }
 
 #include <set>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -29,14 +29,11 @@ using Cmp = std::less<T>;
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l,
-       propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -71,11 +68,3 @@ void test03()
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
   static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
-}
index 47eb61d77fcebf598fb5a1ce140c6436ac52706d..64c46f2e12bb696b17eab88fc0fe75c45c1b7bfe 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=c++11" }
 
 #include <unordered_map>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -37,13 +37,11 @@ struct equal_to
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -76,13 +74,5 @@ void test03()
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
-  // static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
-}
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
+  static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
index de16cbd25e8c7df08dfcc6990d1b1e57050ed195..fe6fc6e0c7281ff14b137d89da4072552c944736 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=c++11" }
 
 #include <unordered_map>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -37,13 +37,11 @@ struct equal_to
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -76,13 +74,5 @@ void test03()
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
-  // static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
-}
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
+  static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
index 5d69e0768ceda9c36efc95a78190fd53d773ca50..2c7e853891fe4447f1eff8b85ed56a7c6c5a7d45 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=c++11" }
 
 #include <unordered_set>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -37,13 +37,11 @@ struct equal_to
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -76,13 +74,5 @@ void test03()
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
-  // static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
-}
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
+  static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
index 0f73126ccd95bb2f0ff58d93e4dc14bad5cedf9b..5ada755fcbf07c1e7151ee75d1d81fd07012bbd1 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=c++11" }
 
 #include <unordered_set>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
 
 struct T { int i; };
@@ -37,13 +37,11 @@ struct equal_to
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -76,13 +74,5 @@ void test03()
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
-  // static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
-}
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
+  static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
index a805a4f0a2d6b0675ddda85a2f1f835cb242e5ff..31231436b03761f82f96422d83721756f8a7191c 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-do compile }
 // { dg-options "-std=gnu++0x" }
 
 #include <vector>
-#include <testsuite_hooks.h>
 #include <testsuite_allocator.h>
  
 struct T { int i; };
 
 namespace __gnu_test
 {
-  inline void
-  swap(propagating_allocator<T, true>& l, propagating_allocator<T, true>& r)
-  noexcept(false)
-  {
-    typedef uneq_allocator<T> base_alloc;
-    swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
-  }
+  template<typename U>
+    inline void
+    swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
+    noexcept(false)
+    { }
 }
 
 using __gnu_test::propagating_allocator;
@@ -66,11 +64,3 @@ void test03()
   static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
   static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
 }
-
-int main()
-{
-  test01();
-  test02();
-  test03();
-  return 0;
-}
index ce44cf80f8812bfc44354816dfd2e3d59c8f4e66..ba44267737f3f1cfe9d295da381aa6f1ca08cf76 100644 (file)
@@ -64,7 +64,9 @@ void test02()
   typedef propagating_allocator<T, true> alloc_type;
   typedef std::vector<T, alloc_type> test_type;
   test_type v1(alloc_type(1));
+  v1.push_back(T());
   test_type v2(alloc_type(2));
+  v2.push_back(T());
   std::swap(v1, v2);
   VERIFY(2 == v1.get_allocator().get_personality());
   VERIFY(1 == v2.get_allocator().get_personality());