aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-10-24 12:55:08 +0000
committerJonathan Wakely <jwakely@redhat.com>2019-10-24 12:55:08 +0000
commitd2a6798b64f2fbda316ab162d0a454731d19f96e (patch)
tree7f905e6837b455244c9f68bc6de0b2420b4f065c
parente02d39501621011f443e680ec80bbe6fbcbeacb0 (diff)
Fix tests that fail with -std=gnu++98 or -std=gnu++11
Backport from mainline 2019-06-06 Jonathan Wakely <jwakely@redhat.com> * testsuite/20_util/is_nothrow_invocable/value.cc: Test converting to void. * testsuite/experimental/names.cc: Do not run for C++98 mode. Do not include Library Fundamentals or Networking headers in C++11 mode. * testsuite/ext/char8_t/atomic-1.cc: Do not run for C++98 mode. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277390 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/names.cc7
-rw-r--r--libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc2
4 files changed, 20 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8a0a4dcc55d..f4ce7a37ee0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,6 +1,15 @@
2019-10-24 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
+ 2019-06-06 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/20_util/is_nothrow_invocable/value.cc: Test converting to
+ void.
+ * testsuite/experimental/names.cc: Do not run for C++98 mode. Do not
+ include Library Fundamentals or Networking headers in C++11 mode.
+ * testsuite/ext/char8_t/atomic-1.cc: Do not run for C++98 mode.
+
+ Backport from mainline
2019-05-14 Jonathan Wakely <jwakely@redhat.com>
* testsuite/util/testsuite_allocator.h (memory_resource)
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
index 0a365a910fc..24ab3d786ec 100644
--- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
@@ -119,9 +119,11 @@ void test01()
static_assert( ! is_nt_invocable_r< T, F >(), "call throws");
static_assert( ! is_nt_invocable_r< NT, F >(), "call throws");
static_assert( ! is_nt_invocable_r< Ex, F >(), "call throws");
+ static_assert( ! is_nt_invocable_r< void, F >(), "call throws");
static_assert( ! is_nt_invocable_r< T, CF >(), "conversion throws");
static_assert( is_nt_invocable_r< NT, CF >(), "" );
static_assert( ! is_nt_invocable_r< Ex, CF >(), "conversion fails");
+ static_assert( is_nt_invocable_r< void, CF >(), "");
static_assert( ! is_nt_invocable< F, int >(), "call throws");
static_assert( is_nt_invocable< F&, int >(), "");
@@ -140,12 +142,14 @@ void test01()
static_assert( is_nt_invocable_r< char&, CF, int >(), "");
static_assert( is_nt_invocable_r< char&, CF&, int >(), "");
+ static_assert( is_nt_invocable_r< void, CF&, int >(), "");
static_assert( ! is_nt_invocable_r< T, CF&, int >(),
"conversion throws");
static_assert( is_nt_invocable_r< NT, CF&, int >(), "");
static_assert( ! is_nt_invocable_r< Ex, CF&, int >(),
"conversion fails, would use explicit constructor");
+ static_assert( is_nt_invocable_r< void, CF&, int >(), "");
static_assert( ! is_nt_invocable< F, int, int >(),
"would call private member");
diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc
index 233b3487981..cfda34948af 100644
--- a/libstdc++-v3/testsuite/experimental/names.cc
+++ b/libstdc++-v3/testsuite/experimental/names.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
// Define macros for some common variables names that we must not use for
// naming variables, parameters etc. in the library.
@@ -25,6 +25,9 @@
#if __has_include(<experimental/filesystem>)
# include <experimental/filesystem>
#endif
+
+#if __cplusplus >= 201402L
+
// Library Fundamentals
#include <experimental/algorithm>
#include <experimental/any>
@@ -66,3 +69,5 @@
# include <experimental/timer>
# include <experimental/executor>
#endif
+
+#endif // C++14
diff --git a/libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc b/libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc
index cecd05df937..0841aa3bb06 100644
--- a/libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc
+++ b/libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc
@@ -1,6 +1,6 @@
// Test that char8_t related atomic types and macros are not present when
// -fchar8_t is not enabled.
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
// { dg-options "-fno-char8_t" }
#include <atomic>