diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-06-06 13:13:42 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-06-06 13:13:42 +0100 |
commit | 061a745005d69e44d6ff50e3ee7fd5b21194c6ac (patch) | |
tree | 28359b4cfc5857210d78d24ea95e8ce988f4a995 | |
parent | d355635e6b96d5d9e67a526b6dfd534cd9a9dd57 (diff) | |
download | gcc-061a745005d69e44d6ff50e3ee7fd5b21194c6ac.zip gcc-061a745005d69e44d6ff50e3ee7fd5b21194c6ac.tar.gz gcc-061a745005d69e44d6ff50e3ee7fd5b21194c6ac.tar.bz2 |
Fix tests that fail with -std=gnu++98 or -std=gnu++11
* testsuite/18_support/set_terminate.cc: Do not run for C++98 mode.
* testsuite/18_support/set_unexpected.cc: Likewise.
* testsuite/20_util/is_nothrow_invocable/value.cc: Test converting to
void.
* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix constexpr
function to be valid in C++11.
* testsuite/26_numerics/complex/proj.cc: Do not run for C++98 mode.
* 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.
From-SVN: r271999
-rw-r--r-- | libstdc++-v3/ChangeLog | 11 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/18_support/set_terminate.cc | 1 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/18_support/set_unexpected.cc | 3 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc | 5 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc | 23 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/26_numerics/complex/proj.cc | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/experimental/names.cc | 7 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/ext/char8_t/atomic-1.cc | 2 |
8 files changed, 41 insertions, 13 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 18c8306..283c6b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,16 @@ 2019-06-06 Jonathan Wakely <jwakely@redhat.com> + * testsuite/18_support/set_terminate.cc: Do not run for C++98 mode. + * testsuite/18_support/set_unexpected.cc: Likewise. + * testsuite/20_util/is_nothrow_invocable/value.cc: Test converting to + void. + * testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix constexpr + function to be valid in C++11. + * testsuite/26_numerics/complex/proj.cc: Do not run for C++98 mode. + * 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. + * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. diff --git a/libstdc++-v3/testsuite/18_support/set_terminate.cc b/libstdc++-v3/testsuite/18_support/set_terminate.cc index 632b9f1..81f182a 100644 --- a/libstdc++-v3/testsuite/18_support/set_terminate.cc +++ b/libstdc++-v3/testsuite/18_support/set_terminate.cc @@ -15,6 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +// { dg-options "-std=gnu++11" } // { dg-do run } #include <exception> diff --git a/libstdc++-v3/testsuite/18_support/set_unexpected.cc b/libstdc++-v3/testsuite/18_support/set_unexpected.cc index dac44e6..7c3f3d4 100644 --- a/libstdc++-v3/testsuite/18_support/set_unexpected.cc +++ b/libstdc++-v3/testsuite/18_support/set_unexpected.cc @@ -15,7 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target { c++98_only || { c++11_only || c++14_only } } } } +// { dg-options "-std=gnu++11" } +// { dg-do run { target { c++11_only || c++14_only } } } #include <exception> #include <testsuite_hooks.h> 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 04d310f..c0c6a7d 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"); @@ -157,6 +161,7 @@ void test01() }; static_assert( is_nt_invocable< FX >(), "FX::operator() is nothrow" ); static_assert( is_nt_invocable_r<X, FX >(), "no conversion needed" ); + static_assert( is_nt_invocable_r<void, FX >(), "" ); struct Y { explicit Y(X) noexcept; // not viable for implicit conversions diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc index 3a133ad..2c00b1f 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc @@ -24,19 +24,24 @@ template<typename... T> { return std::__is_nothrow_invocable<T...>::value; } template<typename R, typename... T> - constexpr bool is_nt_invocable_conv(std::true_type) + struct ConvIsNothrow { using result_type = typename std::__invoke_result<T...>::type; + static void test(std::true_type, R) noexcept; + static void test(std::false_type, const result_type&); + static constexpr bool value + = noexcept(test(std::is_convertible<result_type, R>(), + std::declval<result_type>())); + }; - struct ConvIsNothrow - { - static void test(std::true_type, R) noexcept; - static void test(std::false_type, const result_type&); - }; +template<typename... T> + struct ConvIsNothrow<void, T...> : std::true_type + { }; - return std::is_void<R>::value - || noexcept(ConvIsNothrow::test(std::is_convertible<result_type, R>(), - std::declval<result_type>())); +template<typename R, typename... T> + constexpr bool is_nt_invocable_conv(std::true_type) + { + return ConvIsNothrow<R, T...>::value; } template<typename R, typename... T> diff --git a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc index caf12d2..64e0dec 100644 --- a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc +++ b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } +// { dg-do run { target c++11 } } #include <complex> #include <limits> diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc index 233b348..cfda349 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 cecd05d..0841aa3 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> |