2
0
mirror of https://github.com/boostorg/compat.git synced 2026-01-19 04:02:16 +00:00

Disable is_nothrow_invocable under msvc-14.0

This commit is contained in:
Peter Dimov
2024-03-22 19:15:09 +02:00
parent e270914326
commit 53c5bcf824
2 changed files with 22 additions and 1 deletions

View File

@@ -8,6 +8,8 @@
#include <boost/compat/mem_fn.hpp>
#include <boost/compat/type_traits.hpp>
#include <boost/compat/detail/returns.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <utility>
namespace boost {
@@ -40,6 +42,12 @@ template<class F, class... A> struct is_invocable: detail::is_invocable_<void, F
// is_nothrow_invocable
#if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
template<class F, class... A> struct is_nothrow_invocable: std::false_type {};
#else
namespace detail {
template<class F, class... A> struct is_nothrow_invocable_
@@ -51,6 +59,8 @@ template<class F, class... A> struct is_nothrow_invocable_
template<class F, class... A> struct is_nothrow_invocable: conditional_t< is_invocable<F, A...>::value, detail::is_nothrow_invocable_<F, A...>, std::false_type >::type {};
#endif
} // namespace compat
} // namespace boost

View File

@@ -4,6 +4,8 @@
#include <boost/compat/invoke.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
struct F
{
@@ -84,10 +86,15 @@ int main()
// object
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<F> ));
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<F, char> ));
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<F, int, int> ));
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<F, char> ));
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<F, float, float, float> ));
#endif
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<F, int, int, int, int> ));
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<F const> ));
@@ -117,6 +124,8 @@ int main()
// member data pointer
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<int X::*, X> ));
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<int X::*, X const> ));
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<int X::*, X&> ));
@@ -124,6 +133,8 @@ int main()
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<int X::*, X*> ));
BOOST_TEST_TRAIT_TRUE(( is_nothrow_invocable<int X::*, X const*> ));
#endif
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<int X::*> ));
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<int X::*, int> ));
BOOST_TEST_TRAIT_FALSE(( is_nothrow_invocable<int X::*, X, int> ));