Fix tests that fail in C++2a mode
authorJonathan Wakely <jwakely@redhat.com>
Tue, 29 Jan 2019 00:47:32 +0000 (00:47 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 29 Jan 2019 00:47:32 +0000 (00:47 +0000)
The nested typedefs in std::reference_wrapper are no longer present in
C++2a mode, so skip the tests that check for them.

The addition of the [[nodiscard]] attribute to a few functions causes
some failures in tests that intentionally ignore the return value.
Casting the result to void suppresses the new warnings.

* testsuite/20_util/reference_wrapper/result_type.cc: Disable for
C++2a.
* testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
* testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise.
* testsuite/20_util/reference_wrapper/typedefs.cc: Likewise.
* testsuite/30_threads/async/54297.cc: Suppress nodiscard warning.
* testsuite/ext/array_allocator/26875.cc: Likewise.
* testsuite/ext/pool_allocator/allocate_chunk.cc: Likewise.
* testsuite/util/replacement_memory_operators.h: Likewise.
* testsuite/util/testsuite_allocator.h: Likewise.

From-SVN: r268355

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/reference_wrapper/result_type.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-2.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
libstdc++-v3/testsuite/30_threads/async/54297.cc
libstdc++-v3/testsuite/ext/array_allocator/26875.cc
libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
libstdc++-v3/testsuite/util/replacement_memory_operators.h
libstdc++-v3/testsuite/util/testsuite_allocator.h

index 30038524ec3789bf6fef8244f249b736524efb7c..fc6f7d1a210933db83cad620d78832c42af2a859 100644 (file)
@@ -1,5 +1,16 @@
 2019-01-29  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/20_util/reference_wrapper/result_type.cc: Disable for
+       C++2a.
+       * testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
+       * testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise.
+       * testsuite/20_util/reference_wrapper/typedefs.cc: Likewise.
+       * testsuite/30_threads/async/54297.cc: Suppress nodiscard warning.
+       * testsuite/ext/array_allocator/26875.cc: Likewise.
+       * testsuite/ext/pool_allocator/allocate_chunk.cc: Likewise.
+       * testsuite/util/replacement_memory_operators.h: Likewise.
+       * testsuite/util/testsuite_allocator.h: Likewise.
+
        * include/std/memory_resource (__pool_resource::_M_unpooled): Use
        normal mode vector, even for debug mode.
        * include/std/vector [_GLIBCXX_DEBUG] (_GLIBCXX_STD_C::pmr::vector):
index 81b4986fb41f09d95c4efbdcb4e018d0b2d4a50a..7c67283d2b96f0d582b95ad84df23530c386703b 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-skip-if "result_type removed for C++20" { c++2a } }
 
 // 2010-10-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
index 5db372c82ba502ac24eb8317b88eaf805ff500d3..e1aebd1735220ad004cad7e3ec58af10cc35eba7 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-skip-if "argument_type removed for C++20" { c++2a } }
 
 // 2010-10-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
index 190fe91c13ec176dc3608145d8945949b71de0af..5ca596a10bca4f52a49307f04ed81c81f64712e3 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-skip-if "argument_type removed for C++20" { c++2a } }
 
 // Copyright (C) 2011-2019 Free Software Foundation, Inc.
 //
index a17c1ede0a904ee3da0dffee0f5f548ab260aaab..1f4c77eb006150fbc6858a79fd4181580a248d0f 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-skip-if "result_type removed for C++20" { c++2a } }
 
 // Copyright (C) 2008-2019 Free Software Foundation, Inc.
 //
index 4a2d8fca698046ba6adbec6d10cb914e89fb77ca..654ce40f904f34523df335ffca7d6c080d90e5e2 100644 (file)
@@ -45,5 +45,5 @@ struct Task
 
 int main()
 {
-  std::async(std::launch::async, Task());
+  (void) std::async(std::launch::async, Task());
 }
index d4cbb04d68068501fe917e583c3f38380c4483fa..e72e3b2e0ef4458c018f5940fdc48c09468b6524 100644 (file)
@@ -33,8 +33,8 @@ int main()
 
   try
     {
-      Allocator1.allocate(1);
-      Allocator2.allocate(1);
+      (void) Allocator1.allocate(1);
+      (void) Allocator2.allocate(1);
     }
   catch (std::bad_alloc& ex)
     {
index 1c958d6700c02f391bc0b5a51dcb4e609c345e12..b90778c51d4fe6a2c10d249d0ec5243776db3baf 100644 (file)
@@ -48,13 +48,13 @@ void test01()
   using __gnu_cxx::__pool_alloc;
 
   __pool_alloc<big> alloc_big;
-  alloc_big.allocate(1);
+  (void) alloc_big.allocate(1);
 
   // The constant 20 comes from __pool_alloc_base::_M_refill. See
   // also __pool_alloc_base::_M_allocate_chunk.
   __pool_alloc<small> alloc_small;
   for (unsigned int i = 0; i < 20 * sizeof(big) / sizeof(small) + 1; ++i)
-    alloc_small.allocate(1);
+    (void) alloc_small.allocate(1);
 }
 
 int main()
index 9befe2731401f0128fb13e106a2581ea76451339..fb0b2be7dcf6b61e911331e6fc022790a6f650a8 100644 (file)
@@ -64,7 +64,7 @@ namespace __gnu_test
     check_new(Alloc a = Alloc())
     {
       __gnu_test::counter::exceptions(false);
-      a.allocate(10);
+      (void) a.allocate(10);
       const bool __b((__gnu_test::counter::count() > 0) == uses_global_new);
       if (!__b)
        throw std::logic_error("counter not incremented");
index 0e77ff49a3a8d3945f6e5ea848511cb972e6f37b..044b9d5a90f29aea4a9ab684e149448fd3dc5ba0 100644 (file)
@@ -245,7 +245,7 @@ namespace __gnu_test
       Alloc a;
       try
        {
-         a.allocate(a.max_size() + 1);
+         (void) a.allocate(a.max_size() + 1);
        }
       catch(std::bad_alloc&)
        {