]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/callable_traits/test/is_invocable.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / callable_traits / test / is_invocable.cpp
index 7ca131b1a99b731ab4935177c7a28a6024248c34..e7dfe8c280482be6b5e5d9c72de68540a6903489 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright Barrett Adair 2016-2017
+Copyright Barrett Adair 2016-2021
 Distributed under the Boost Software License, Version 1.0.
 (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
 */
@@ -25,17 +25,17 @@ struct invoke_case {
    template<typename Callable>
    void operator()(tag<Callable>) const {
 
-// when available, test parity with std implementation (c++2a breaks our expectations but we still match std impl)
-#if defined(__cpp_lib_is_invocable) || __cplusplus >= 201707L
+       CT_ASSERT((Expect == boost::callable_traits::is_invocable<Callable, Args...>()));
+#ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
+       CT_ASSERT((Expect == boost::callable_traits::is_invocable_v<Callable, Args...>));
+#endif
+
+// when available, test parity with std implementation
+#if defined(__cpp_lib_is_invocable)
        CT_ASSERT((std::is_invocable<Callable, Args...>() == boost::callable_traits::is_invocable<Callable, Args...>()));
 #  ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
        CT_ASSERT((std::is_invocable_v<Callable, Args...> == boost::callable_traits::is_invocable_v<Callable, Args...>));
 #  endif
-#else
-       CT_ASSERT((Expect == boost::callable_traits::is_invocable<Callable, Args...>()));
-#  ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
-       CT_ASSERT((Expect == boost::callable_traits::is_invocable_v<Callable, Args...>));
-#  endif
 #endif
 
    }
@@ -124,19 +124,28 @@ int main() {
         ,invoke_case<false, std::reference_wrapper<foo>, int>
     >();
 
-// MSVC doesn't handle cv + ref qualifiers in expression sfinae correctly
-#ifndef BOOST_CLBL_TRTS_MSVC
+// old MSVC doesn't handle cv + ref qualifiers in expression sfinae correctly
+#ifndef BOOST_CLBL_TRTS_OLD_MSVC
+
+#if __cplusplus <= 201703L
+#define QUIRKY_CASE true
+#else
+#define QUIRKY_CASE false
+#endif
 
     run_tests<void(foo::*)() const LREF
-        ,invoke_case<false, foo>
+
+#ifndef BOOST_CLBL_TRTS_MSVC
+        ,invoke_case<!QUIRKY_CASE, foo>
+        ,invoke_case<!QUIRKY_CASE, foo&&>
+        ,invoke_case<!QUIRKY_CASE, foo const>
+        ,invoke_case<!QUIRKY_CASE, foo const&&>
+#endif
         ,invoke_case<true, foo*>
         ,invoke_case<true, foo&>
-        ,invoke_case<false, foo&&>
         ,invoke_case<true, std::reference_wrapper<foo>>
-        ,invoke_case<false, foo const>
         ,invoke_case<true, foo const*>
         ,invoke_case<true, foo const&>
-        ,invoke_case<false, foo const&&>
         ,invoke_case<true, std::reference_wrapper<foo const>>
         ,invoke_case<false, foo, int>
         ,invoke_case<false, foo*, int>
@@ -163,7 +172,7 @@ int main() {
         ,invoke_case<false, std::reference_wrapper<foo>, int>
     >();
 
-#endif // #ifndef BOOST_CLBL_TRTS_MSVC
+#endif // #ifndef BOOST_CLBL_TRTS_OLD_MSVC
 
     run_tests<int
         ,invoke_case<false, foo>