Fix libstdc++ testsuite failures in C++98 and C++11 mode
authorJonathan Wakely <jwakely@redhat.com>
Thu, 26 Jan 2017 19:39:53 +0000 (19:39 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 26 Jan 2017 19:39:53 +0000 (19:39 +0000)
* testsuite/23_containers/list/operations/78389.cc: Fix for C++11
mode.
* testsuite/23_containers/priority_queue/requirements/constructible.cc:
Mark as unsupported in C++98 mode.
* testsuite/23_containers/queue/requirements/constructible.cc:
Likewise.
* testsuite/23_containers/stack/requirements/constructible.cc:
Likewise.
* testsuite/25_algorithms/make_heap/movable.cc: Fix for C++11 mode.

From-SVN: r244950

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
libstdc++-v3/testsuite/23_containers/priority_queue/requirements/constructible.cc
libstdc++-v3/testsuite/23_containers/queue/requirements/constructible.cc
libstdc++-v3/testsuite/23_containers/stack/requirements/constructible.cc
libstdc++-v3/testsuite/25_algorithms/make_heap/movable.cc

index 1428ffe95c21ad8ee468b82d46fc2a2dbb755532..ceb15b0a304910abb7ee45f3bd7406b451790d86 100644 (file)
@@ -1,5 +1,15 @@
 2017-01-26  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/23_containers/list/operations/78389.cc: Fix for C++11
+       mode.
+       * testsuite/23_containers/priority_queue/requirements/constructible.cc:
+       Mark as unsupported in C++98 mode.
+       * testsuite/23_containers/queue/requirements/constructible.cc:
+       Likewise.
+       * testsuite/23_containers/stack/requirements/constructible.cc:
+       Likewise.
+       * testsuite/25_algorithms/make_heap/movable.cc: Fix for C++11 mode.
+
        PR libstdc++/79243
        * include/bits/c++config (literals::string_view_literals::__7): Add.
        Only declare versioned namespaces for the relevant C++ dialects.
index 4d8b7d2818b4bc7f81dc52fef7496a9d83f6d981..e0cc6e63c7648972ffa9bbc793078e33c89dacf4 100644 (file)
 
 // 23.2.2.4 list operations [lib.list.ops]
 
-#include <testsuite_hooks.h>
-
 #include <list>
+#include <testsuite_hooks.h>
 
 struct ThrowingComparator
 {
-  unsigned int throw_after = 0;
-  unsigned int count = 0;
+  ThrowingComparator(unsigned n) : throw_after(n), count(0) { }
+  unsigned int throw_after;
+  unsigned int count;
   bool operator()(int, int) {
     if (++count >= throw_after) {
       throw 666;
     }
-    return true;
+    return false;
   }
 };
 
index fa412f33771d8c1f99ef22c0a9db88c12e3d253f..b03af48ff3b687c9f623ae93c968c5a3a7c4593d 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
index 99a8b840d967c56e15edc4e6754eb1b98d534dfe..5f2bf30407acd2e9631b58e0ecc05341cb1e1dc7 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
index 0d6e174a79646584cb9d2caf44433e09c68fea3c..76785be29e66684a5ac6a63bbceb624f0ac6060b 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
index f6738f1d6db0f2357f56446cfd0eaf0d05011dda..7d34ff248bc94d6444b06cffe744fd1118486d2b 100644 (file)
@@ -25,7 +25,7 @@ void
 test01()
 {
   int i[] = { 1, 2, 3, 4 };
-  std::function<bool(int, int)> f = std::less<>{};
+  std::function<bool(int, int)> f = std::less<int>{};
   // If this uses a moved-from std::function we'll get an exception:
   std::make_heap(std::begin(i), std::end(i), f);
   std::sort_heap(std::begin(i), std::end(i), f);